Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show image in image view from URL coming from Push notification
    primarykey
    data
    text
    <p>I want to shoe image in view based on URL, but url is coming as push notification, i am getting all PNS properly, also got image URL successfully but image is not displaying properly. below code i am using when i got new push notification i am opening that notification and calling methods whch is in another view where i want to set image.</p> <pre><code>- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if (application.applicationState == UIApplicationStateActive) { 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 sshowansimage:imageURL]; // CALL METHOD OF ANTOHER CLASS WHERE I WANT TO SET IMAGE } </code></pre> <p>now here is code for sshowansimage method which is mainviewcontrriler class</p> <pre><code>-(void) sshowansimage:(NSString *) strImageURL{ NSURL *imageURL = [NSURL URLWithString:strImageURL]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSData *imageData = [NSData dataWithContentsOfURL:imageURL]; dispatch_async(dispatch_get_main_queue(), ^{ // Update the UI imgeview.image = [UIImage imageWithData:imageData]; }); }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload