gpt4 book ai didi

iphone - 如何解决在类型为 "AppDelegate"的对象上找不到属性数组错误

转载 作者:行者123 更新时间:2023-11-29 13:31:53 24 4
gpt4 key购买 nike

我正在尝试使用以下代码发布到用户 friend 的 FB 墙上。我被困在这条线上:** NSString *post=[[delegate.array objectAtIndex:tag.tag] objectForKey:@"id"];

**
错误消息:“在类型为“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];

最佳答案

过去 3 天,我发现您在使用 iPhone 获取 Facebook 好友时遇到了问题。所以我为你做了一个演示。希望你喜欢这个。:)

Fetch Facebook friend here

关于iphone - 如何解决在类型为 "AppDelegate"的对象上找不到属性数组错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11647343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com