开发者

Facebook iOS Safari "Cannot Open Page Error" When Authenticating User with Single-Sign-On

I'm spinning in circles with this issue - and it looks like Facebook has some open tickets regarding it, but I wanted to see if anyone had the same issue I'm having and found a temporary or better solution.

I downloaded Facebook's "DemoApp", and can put in my appId into its info.plist as so: fb1234567890 (where 1234567890 is my appId). It can authenticate the user by multitasking to Safari, entering my credentials, allowing my application access, and then redirecting back to "DemoApp" with me logged in (and I can request my information fine).

NOW, I'm trying to integrate DemoApp's functionality into my existing application.

I am able to access the login screen, and enter my credentials. It allows me to give my application access to my personal information - I click allow and Safari processes a new request, and then returns the error message: Safari cannot open the request because the address is invalid at the URL: http://www.facebook.com/connect/uiserver.php

HOWEVER, If I have DemoApp installed on my simulator and my own application, it will switch BACK to DemoApp with my successfully logged in. If I uninstall DemoApp and try again with my application, I get the Safari error.

WHAT CAN I DO TO SOLVE THIS?? Any help would be great; I'm banging my head here.:(

My info.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>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string></string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb1234567890</string>
            </array>
        </dict>
    </array>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleDisplayName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType<开发者_Go百科/key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSMainNibFile</key>
    <string>MainWindow</string>
</dict>
</plist>


The CFBundleURLTypes entry is incorrect. It should look like this:

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


I had a very similar experience. I found that the plist changes I was making were simply not being absorbed into the simulator, even after a clean build. I was able to make them take by changing the Hardware->Device setting to something different, and then back again. Somehow, this appears to have caused the plist changes to register with the OS on the simulator, whereas nothing else I did had that effect. Not sure this is the "right" way to do it, or if something in the build settings is messed up, but this, for me, did work around the exact problem you are describing.


Marks answer steered me in the right direction but my problem was a bit different. For some reason the plist looked like this:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb1234567890
[defaults setObject:[facebook expirationDate] forKey:@&quot;FBExpirationDat</string>
        </array>
    </dict>
</array>

I just deleted the data after the id and it was fixed:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb1234567890</string>
        </array>
    </dict>
</array>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜