2015-06-05 78 views
7

我正在使用Facebook-iOS-SDK-4作为FB登录,但是当我尝试编译时,我有这个错误。Facebook iOS SDK 4错误info.plist

2015年6月5日03:15:02.001 Hooiz [4681:781254 ***终止应用程序由于 未捕获的异常 'InvalidOperationException异常',原因是: “fb620223481391648未注册的URL方案。请您 Info.plist中”

.plist是像Facebook的文档添加:

enter image description here

+1

请确保您的帐号(fb620223481391648)正面或背面 – Singhak

回答

-1

再次检查你的脸书应用程序ID。在您的info.plist中添加您注册的脸书应用程序ID。并且还要添加URL计划标识符fbXXXXXXXXXXXX(XXXXXXXXX是您之前添加的Facebook应用程序ID)到info.plist并检查

希望这有助于!

7

打开info.plist文件,文本编辑器,你应该找到像这样

<key>CFBundleURLTypes</key> 
<array> 
    <dict> 
     <key>CFBundleURLName</key> 
     <string></string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
      <string>fb288500927xxxxx</string> 
     </array> 
    </dict> 
</array> 
<key>Item 0</key> 
<dict> 
    <key>CFBundleURLSchemes</key> 
    <array> 
     <string>fb288500927xxxxxx</string> 
    </array> 
</dict> 
<key>CFBundleVersion</key> 
<string>1</string> 
<key>FacebookAppID</key> 
<string>288500927xxxxxx</string> 
<key>FacebookDisplayName</key> 
<string>حميتي</string> 

将其更改为这种格式(注意这两个格式之间的差)清洁构建和重新启动的XCode。和你做:)

<key>CFBundleURLTypes</key> 
<array> 
    <dict> 
     <key>CFBundleURLName</key> 
     <string></string> 
     <key>CFBundleURLSchemes</key> 
     <array> 
      <string>fb288500927xxxxxx</string> 
     </array> 
    </dict> 
</array> 
<key>CFBundleVersion</key> 
<string>1</string> 
<key>FacebookAppID</key> 
<string>288500927xxxxxx</string> 
<key>FacebookDisplayName</key> 
<string>حميتي</string> 
+0

你能解释一下什么是两者之间的不同没有空间?因为我没有看到任何格式差异... –

+1

看看CFBundleURLSchemes如何在每种情况下构建的部分:) – OXXY

+0

仍然没有修复我的应用程序 –

3

第一, 验证是否正确地做Getting Started指令。

验证您将此代码添加到您的应用程序代理:

#import <FBSDKCoreKit/FBSDKCoreKit.h> 

- (void)applicationDidBecomeActive:(UIApplication *)application { 
    [FBSDKAppEvents activateApp]; 
} 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    return [[FBSDKApplicationDelegate sharedInstance] application:application 
            didFinishLaunchingWithOptions:launchOptions]; 
} 

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
    return [[FBSDKApplicationDelegate sharedInstance] application:application 
                 openURL:url 
               sourceApplication:sourceApplication 
                annotation:annotation]; 
} 

之后, 下面有信息的另一部分 - URL类型(这是我花了几个小时)

检查值是否存在,URL Schemes字段匹配值U RL类型 - > URL Schemes在上面的属性列表中。 (也匹配FacebookAppID)

URL Types