Hi.
I'm learning Swift and struggling with a process for obtaining an image from the web via passing a parameter to a URL.
The code is as follows
The first line shows errors relating to 'Consecutive statements on a line must be separated by ;' yet my code seems to be as suggested by all online tutorials etc.
Anyone either know what's wrong or how to grab an image file from a server by passing a parameter to the url?
Many thanks and Happy New Year!
I'm learning Swift and struggling with a process for obtaining an image from the web via passing a parameter to a URL.
The code is as follows
Code:
NSString* myURLString = [NSString stringWithFormat:@"http://mydomain.com/uploads/%@", userimg]; NSURL* imageURL = [NSURL URLWithString:myURLString]; NSData* imageData = [NSData dataWithContentsOfURL:imageURL]; UIImage* image = [UIImage imageWithData:imageData]; self.userAvatar.image = image;
Anyone either know what's wrong or how to grab an image file from a server by passing a parameter to the url?
Many thanks and Happy New Year!
Comment