问题
i have worked on this project for a couple of months and i have only been programming for about a year so im not to smart on this subject so please be patient, i have create a login with Facebook and once i fetch the user info i have created a method to parse the info to the login view

and i place this method in the

and this method pushes to the loginViewController once it has received the info, im try to pass the same info to the settingViewController to show the name and the pic which is user.name and user.id and i did the same steps and use the same protocols and it doesnt work now my question is, because im useing the info in the loginViewController i cant place or use them in the settingViewController because im using the info already. could you please help me out with this i have only just in the last month sort of rapped my head around using protocols.
回答1:
Make sure you have set an identifier for the segue
:

and set profilePicture (your case) as a public property in the 2nd view controller.
Then in your 1st view controller, simply use prepareForSegue:
to pass your profilePicture property
:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"SecondVCSegue"]) {
SecondViewController *secondVC = segue.destinationViewController;
secondVC.profilePicture = profilePicture;
}
}
UPDATE:
have you identified the view controller in your storyboard ?

回答2:
Store all your fetched data in an custom class and pass the object to your destination view controller using
(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
using something like this here UBO is my Custom class and user is facebook user object... that object contains id, image and email address..
UBO = [[UserBusinessObject alloc]init];
UBO.userid=user.id;
NSLog(@"%@",UBO.userid);
UBO.email=[user objectForKey:@"email"];
NSLog(@"%@",UBO.email);
NSString *imageUrl=[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=normal",UBO.userid];
NSLog(@"%@image returning",imageUrl);
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]]; //NSLog(@"image data %@",imageData); UBO.profilePic=imageData;
来源:https://stackoverflow.com/questions/22864989/can-i-share-facebook-user-name-and-user-id-with-multiple-views