iOS)我应该在哪里复制和粘贴 facebook XML 片段?

标签 ios xml facebook plist

我正在制作 Facebook 登录,我很好地遵循了所有步骤,但配置了我的 info.plist。我的 xml 代码如下:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
</array>

<key>FacebookAppID</key>
<string>12345678</string>
<key>FacebookDisplayName</key>
<string>AppName</string>

我将此 xml 添加到我项目中 info.plist 的“dict”部分,而不是我的 projectTest。 所以最后,我完成了我的 .plist xml 文件

但是我得到了一个错误

error: couldn't parse contents of '/Users/~/Desktop/app/app/myproject/Info.plist': The data couldn’t be read because it isn’t in the correct format.

我该如何解决这个问题?

更新

整个 .plist 如下:

<?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">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.myproject.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>

/*FACEBOOK XML IS JUST BELOW*/ 
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
</array> 
<key>FacebookAppID</key>
<string>12345678</string>
<key>FacebookDisplayName</key>
<string>AppName</string>
/**/

<array>
    <string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

最佳答案

您在错误的位置添加了代码段:

<key>UIRequiredDeviceCapabilities</key> <<----- this one should go with

/*FACEBOOK XML IS JUST BELOW*/ 
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
</array> 
<key>FacebookAppID</key>
<string>12345678</string>
<key>FacebookDisplayName</key>
<string>AppName</string>
/**/

<array>                      << ------------- this one
    <string>armv7</string>
</array>

之前添加fb片段 ojit_代码

或之后

    <array>                      << ------------- this one
        <string>armv7</string>
    </array>

关于iOS)我应该在哪里复制和粘贴 facebook XML 片段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32263957/

相关文章:

ios - TestFlight:如何在上传到 App Store 之前添加要构建的测试详细信息?

javascript - 当 IOS 上的 ALPHA 为零时,Three.js 将纹理 RGB 值设置为零

python - 遍历 xml 在 python 中不起作用

facebook - 音频嵌入不再起作用了吗?

ios - SKPaymentTransaction transactionIdentifier 与我的收据不匹配

ios - tabbarcontroller下tableview最后一行被截断

python - Odoo 10 在 XML 中使用配置值(存储在 ir.values 中)

css - 如何使用 css 将图像添加到 xml 工作表

php - 使用 Facebook PHP SDK 进行身份验证时出现问题

javascript - Facebook 永久访问 token