2012-03-10 65 views
4

您好我正在使用faceobok连接和官方Facebook教程如下: https://developers.facebook.com/docs/mobile/ios/build/ 现在,当我模拟它到Facebook然后它sais关于应用程序的东西,你按完成。当我按下完成后,safari无法打开页面,因为它是无效地址。这里是我的财产名单:Facebook Connect 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> 

回答

4

你CFBundleURLSchemes键看起来错误的,因为该应用程序应该是fb387500177929927,不387500177929927

the docs

使用包含单个值fbYOUR_APP_ID(文字字符fb 后跟您的应用ID)的单个项目URL架构 创建一个名为URL类型的新行。

+0

oh ok thx a lot – MCKapur 2012-03-10 15:27:38

相关问题