AppID未检测到

时间:2015-08-12 12:23:05

标签: ios iphone swift

我想在Swift中使用facebook登录。他们给我错误AppId没有在Plist中设置,但我在plist上设置AppId。它给出了这个错误:

  

my2015-08-12 17:49:27.211 swiftcontact [16083:2102678] ***终止   应用程序由于未捕获的异常'InvalidOperationException',原因:   '找不到应用ID。使用您的应用ID为密钥添加字符串值   FacebookAppID到Info.plist或调用[FBSDKSettings setAppID:]。'

这些是我的plist文件的内容:

<dict>
    <key>FacebookAppID</key>
    <string>9023XXXXXXXXXXX</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.varun.$(PRODUCT_NAME:rfc1034identifier)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>FacebookDisplayName</key>
    <string>BOOMaGIFT</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb9023XXXXXXXXXXX</string>
            </array>
            <key>CFBundleURLName</key>
            <string></string>
        </dict>
    </array>
    <key>LSRequiresIPhoneOS</key>
    <true/>
</dict>
</plist>

2 个答案:

答案 0 :(得分:0)

我也遇到了这个,我所做的就是在viewDidLoad中声明我的app id,就像这个FBSDKSettings.setAppID(“your_app_id”)一样。

答案 1 :(得分:0)

就我而言,我忘记在 AppDelegate 中添加 Facebook 的 ApplicationDelegate 方法

ApplicationDelegate.shared.application(_:, didFinishLaunchingWithOptions:)