Facebook iOS Safari在使用单一login进行身份validation时,“无法打开页面错误”

我在这个问题上圈了一圈 – 看起来Facebook有一些关于它的公开门票,但我想看看是否有人有我遇到的同样的问题,并find一个临时或更好的解决scheme。

我下载了Facebook的“DemoApp”,并且可以将appId放入其info.plist中,如下所示: fb1234567890 (其中1234567890是我的appId)。 它可以通过多任务处理对Safari进行身份validation,input我的凭据,允许我的应用程序访问,然后redirect到“DemoApp”,我login(我可以要求我的信息很好)。

现在,我试图将DemoApp的function集成到我现有的应用程序中。

我可以访问login屏幕,并input我的凭据。 它允许我让我的应用程序访问我的个人信息 – 我点击allow和Safari处理一个新的请求,然后返回错误消息Safari cannot open the request because the address is invalid的URL: http://www.facebook.com/connect/uiserver.php

但是,如果我的模拟器和我自己的应用程序上安装了DemoApp ,它将切换回到DemoApp与我成功login。如果我卸载DemoApp并再次尝试与我的应用程序,我得到Safari错误。

我可以做些什么来解决这个问题? 任何帮助将是伟大的; 我在这里敲我的头。

我的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</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> 

CFBundleURLTypes条目不正确。 它应该是这样的:

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

我有一个非常相似的经验。 我发现我制作的plist变化根本没有被吸收到模拟器中,即使在一个干净的构build之后。 我能够通过将硬件 – >设备设置更改为不同的东西,然后再回来。 不知何故,这似乎导致plist更改注册与模拟器上的操作系统,而没有别的我有这样的效果。 不知道这是做到这一点的“正确”方式,或者如果构build设置中的某些东西混乱了,但对我而言,这确实解决了您所描述的确切问题。

马克斯的回答让我走向了正确的方向,但是我的问题有点不同。 由于某种原因,plist看起来像这样:

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

我刚刚删除了id后的数据,它被修复了:

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