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

时间:2015-08-28 05:32:55

标签: 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添加到&#39; dict&#39;在我的项目的info.plist而不是我的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>

1 个答案:

答案 0 :(得分:1)

您正在将代码段添加到错误的位置:

<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代码段 <key>UIRequiredDeviceCapabilities</key>

或之后

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