加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – Facebook Connect Safari无法打开页面

发布时间:2020-12-14 17:37:23 所属栏目:百科 来源:网络整理
导读:我正在使用faceobok connect和下面的官方Facebook教程: https://developers.facebook.com/docs/mobile/ios/build/ 现在,当我模拟它进入Facebook然后它是关于应用程序的东西,你按完了.当我按完了它时,sais safari无法打开页面,因为它是一个无效的地址.这是我
我正在使用faceobok connect和下面的官方Facebook教程:
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).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读