0
我創建了一個使用facebook圖形API的Facebook應用程序我想要的是獲取當前登錄的用戶的用戶名。下面是代碼如何獲取當前登錄的用戶的用戶名使用最新的facebook圖形API
-(IBAction)bomb
{
facebook = [[Facebook alloc] initWithAppId:@"109133762519851"];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![facebook isSessionValid]) {
[facebook authorize:nil delegate:self];
}
}
- (void)fbDidLogin {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
NSLog(@"facebook:%@",defaults);
[facebook dialog:@"stream.publish" andParams:params andDelegate:self]; */
NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];
NSString *wallPost = @"wat de heck";
NSString *linkURL = @"http://www.supersite.com";
NSString *imgURL = @"http://www.supersite.com/image.jpg";
[fbArguments setObject:wallPost forKey:@"message"];
[fbArguments setObject:linkURL forKey:@"link"];
[fbArguments setObject:imgURL forKey:@"picture"];
//NSLog(@"username:%@",facebook.);
[facebook requestWithGraphPath:@"me/feed"
andParams:fbArguments
andHttpMethod:@"POST"
andDelegate:self];
}
即時得到一個錯誤的DAT 「request.method是諾塔結構或聯合」 使用最新的小號 – kingston
IM dk ..上面兩個類im無法導入 – kingston
即時通訊不能找到當前登錄的用戶 – kingston