hanumanDev
hanumanDev

Reputation: 6614

How to resolve property array not found on object of type "AppDelegate" error

I'm trying to post to a user's friend's FB wall with the following code. I'm stuck on this line: ** NSString *post=[[delegate.array objectAtIndex:tag.tag] objectForKey:@"id"];

**
with the error message: "property array not found on object of type "AppDelegate"

AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

        //Call the request method
        [[delegate facebook] requestWithGraphPath:@"me/friends" andDelegate:self];


        // get the array of friends                
        NSArray *data = [result objectForKey:@"data"];

        // Check that the user has friends
        if ([data count] > 0) {

            NSMutableArray *array = [NSMutableArray array];    
            for (int i = 0; i < data.count; i++){
                id object = [data objectAtIndex:i];
                [array addObject:[object objectForKey:@"name"]];
            }

            NSLog(@"list of friends %@", array);

            NSString *Message = [NSString stringWithFormat:@"-posted via iPhone App"];
            NSMutableDictionary *params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                            Message, @"message", nil];
            NSString *post=[[delegate.array objectAtIndex:tag.tag] objectForKey:@"id"];

            [[delegate facebook] requestWithGraphPath:[NSString stringWithFormat:@"/%@/feed",post] andParams:params1 andHttpMethod:@"POST" andDelegate:self];

            UIAlertView  *alert = [[UIAlertView alloc] initWithTitle:@"Message!" message:@"Message Sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
            [alert release];

Upvotes: 1

Views: 544

Answers (1)

M.B
M.B

Reputation: 885

Last 3 days i realize you got problem with get facebook friend in iphone. so i make a demo for you . hope you enjoy this.:)

Fetch Facebook friend here

Upvotes: 1

Related Questions