我是 ios 和 PNS 的新手,我正在处理推送通知,基于此我在通知中获取 URL,我需要将图像显示到图像视图中。我成功获得了 PNS 也使用有效负载获得了 URL,但它没有显示在另一个类的图像视图中下面是我正在使用的代码
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
if (application.applicationState == UIApplicationStateActive) // If app is running and you got notification then show it
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Did receive a Remote Notification" message:[NSString stringWithFormat:@"You Have a Notification :\n%@",userInfo[@"aps"][@"alert"]]delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
NSLog(@"Payload: %@", userInfo);
imageURL = userInfo[@"aps"][@"alert"];
MainViewController *mv = [[MainViewController alloc] init];
[mv.ansinage setImage:[UIImage imageNamed:@"cartoon.png"]]; // Right now i am setting image in resource but still not setting in mainviewcontrller when i am open app
}