I am facing a problem to convert NSString to UIImage. EDIT1: I'm downloading photo as a string from gtalk server and parsed xml 5896efb83a92deaee41a30648cc9dbf7e9942b0e to use as an image.
NSString *myPicture = [presence photo];
NSData *pic = nil;
if (![myPicture isEqualToString:@""]) {
pic = [myPicture dataUsingEncoding:NSUTF8StringEncoding];
}
UIImage *picture;
NSLog(@"Photo %@", pic);
if (pic == nil) {
picture = [UIImage imageWithData:[Utils getAvatar]];
}
else {
picture = [UIImage imageWithData:pic];
}
NSLog(@"Picture %@", picture);
The logs
Photo 35383936 65666238 33613932 64656165 65343161 33303634 38636339 64626637 65393934 32623065 Picture (null)
The part with
picture = [UIImage imageWithData:[Utils getAvatar]]works fine
Any idea?
UIImagewith a string drawn inside it? - Costique