Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

reetu.raj

macrumors newbie
Original poster
Mar 12, 2009
3
0
Hello I am using MKAbeFook to get userinfo .... I am sure someone who has used it before can help me out in sorting out my problem.

//first I am adding the request parameter
Code:
[parameters setValue:@"pic" forKey:@"fields"];
[parameters setValue:@"first_name" forKey:@"fields"];

then I am displaying the paramaters
Code:
[userInfoTextView setText:[NSString stringWithFormat:@"Hello %@", [[[response rootElement] dictionaryFromXMLElement] valueForKey:@"first_name"]]];
		
	[user_profile_pic setImage:[[UIImage imageNamed:[[[response rootElement] dictionaryFromXMLElement] valueForKey:@"pic"]]retain]];

where I have defined in .h file following objects:
Code:
IBOutlet UITextView *userInfoTextView;
	IBOutlet UIImageView *user_profile_pic;


I can see the output for first_name
but I cant see the image
Anybody having any idea what am I doing wrong in the code above ?

Thanks a lot !
 
I can see the issue. Your problem lies here:

Code:
[user_profile_pic setImage:[[UIImage [B]imageNamed[/B]:[[[response rootElement] dictionaryFromXMLElement] valueForKey:@"pic"]]retain]];

This method will only retrieve an image from the app bundle (and I think, other local paths), but will definitely not retrieve an image from a URL.

I would suggest this code to create a UIImage from a URL:

Code:
id path = @"http://merrimusings.mu.nu/archives/images/groundhog2.jpg";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data cache:NO];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.