1

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];
4

1 に答える 1

1

過去 3 日間、iPhone で Facebook の友達を取得する際に問題が発生したことに気付きました。だから私はあなたのためにデモを作ります。これを楽しんでください。:)

ここでFacebookの友達を取得

于 2012-07-25T10:39:25.060 に答える