我正在使用faceobok connect和下面的官方Facebook教程:
https://developers.facebook.com/docs/mobile/ios/build/
现在,当我模拟它进入Facebook然后它是关于应用程序的东西,你按完了.当我按完了它时,sais safari无法打开页面,因为它是一个无效的地址.这是我的房源清单:
https://developers.facebook.com/docs/mobile/ios/build/
现在,当我模拟它进入Facebook然后它是关于应用程序的东西,你按完了.当我按完了它时,sais safari无法打开页面,因为它是一个无效的地址.这是我的房源清单:
这是我的代码:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return [facebook handleOpenURL:url]; } // For iOS 4.2+ support - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [facebook handleOpenURL:url]; } - (void)fbDidLogin { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; [defaults synchronize]; } -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex { if (buttonIndex == 0) { // facebook facebook = [[Facebook alloc] initWithAppId:@"387500177929927" andDelegate:self]; 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]; } } }
物业清单:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>387500177929927</string> </array> </dict> </array> </plist>
解决方法
你的CFBundleURLSchemes键看起来不对,对于那个应用它应该是fb387500177929927,而不是387500177929927
从the docs起
Create a new row named URL types with a single item,URL Schemes,containing a single value,fbYOUR_APP_ID (the literal characters fb followed by your app ID).