简体   繁体   English

Facebook iOS SDK 4错误信息.plist

[英]Facebook iOS SDK 4 error info.plist

I'm using the Facebook-iOS-SDK-4 for a FB login but when I try to compile I have this error. 我正在使用Facebook-iOS-SDK-4进行FB登录,但是当我尝试编译时出现此错误。

2015-06-05 03:15:02.001 Hooiz[4681:781254] *** Terminating app due to uncaught exception 'InvalidOperationException', reason: 'fb620223481391648 is not registered as a URL scheme. 2015-06-05 03:15:02.001 Hooiz [4681:781254] ***由于未捕获的异常'InvalidOperationException'终止应用程序,原因:'fb620223481391648未注册为URL方案。 Please add it in your Info.plist' 请将其添加到您的Info.plist中

My .plist is like the Facebook documentation : 我的.plist就像Facebook文档:

在此输入图像描述

Open your info.plist file with text editor you should find it like this 使用文本编辑器打开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>

Change it to this format (notice the difference between the two format) clean the build and restart XCode. 将其更改为此格式(注意两种格式之间的差异)清理构建并重新启动XCode。 and you are done :) 你完成了:)

    <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>

first, verify that you do the Getting Started instructions correctly. 首先,验证您是否正确执行了“ 入门”说明。

verify that you add this code to your app delegate: 验证您是否将此代码添加到您的应用代理:

#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];
}

After that, There is another section below the info - URL Types (and this is where I spent few hours) 在那之后,信息下面还有另一部分 - 网址类型 (这是我花了几个小时的地方)

check that the values there, under the URL Schemes field match the value in the URL types -> URL Schemes in the property list above. 检查URL Schemes字段下的值是否与上面属性列表中URL类型 - > URL Schemes中的值匹配。 (and also match the FacebookAppID) (还匹配FacebookAppID)

网址类型

Check your face book app id once again. 再次检查您的面部书籍应用程序ID。 Add your registered face book app id in your info.plist. 在info.plist中添加已注册的面部书籍应用程序ID。 And Also add URL Scheme identifier, fbXXXXXXXXXXXX(XXXXXXXXX is your facebook app id which is added previously) to info.plist and check 并添加URL方案标识符,fbXXXXXXXXXXXX(XXXXXXXXX是您以前添加的Facebook应用程序ID)到info.plist并检查

Hope this helps!! 希望这可以帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM