I’m trying to pass NSDictionary between classes. In my AppDelegate I have instance NSDictionary.
@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate, FBRequestDelegate>
{
NSDictionary *contactsFromFacebook;
}
@property (strong, nonatomic) NSDictionary *contactsFromFacebook;
In my AppDelegate.m file I synthesized it as @synthesize contactsFromFacebook = _contactsFromFacebook;. Next my step (filling dictionary):
-(void)request:(FBRequest *)request didLoad:(id)result {
_contactsFromFacebook = [[NSDictionary alloc]initWithDictionary:result];
}
In my someClass.m file I want to use data from contactsFromFacebook dictionary.
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSDictionary *someNewDictionary = [[NSDictionary alloc] initWithDictionary:appDelegate.contactsFromFacebook];
But my someNewDictionary is ampty. What I’m doing wrong?
In appDelegate write a method:
And then in other class:
And this works fine for me.
Edit:
@Abizern comment i think resolve your issue. He is right.