2012-03-10 149 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

相關問題