Facebook SDK 4.5 IOS 9 - ios

I got an issue with the new FBSDK. Whenever I try to call the login method logInWithReadPermissions, I get this error message:
ERROR : "canOpenUrl : failed for url "fbauth2://" error: "(null)"
I have my config .plist file following the ios9 tuto ( https://developers.facebook.com/docs/ios/ios9 ) on dev.facebook. So, I got the NSAppTransportSecurity dictionary and the LSApplicationQueriesSchemes array (with the string "fbauth2" on it)
Would you know how to resolve this error?

If you still continue to have problems, reset the simulator, this worked for me.

I have the same problem with Google+ Sign-in library,
but i solved for Facebook updating at the last SDK version 4.6.0!
Remember to change your plist key LSApplicationQueriesSchemes after the update like this:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>

1] Authentication in Developer.facebook and generate Facebook Id like :=>460481580805052
2] Set Bitcode : No From Build Settings
3] Set up Plist File
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb460481580805052</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>460481580805052</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2 </string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
</array>
4] Download 4 Sdk Framework like
=>Bolts.framework
=>FBSDKCoreKit.framework
=>FBSDKLoginKit.framework
=>FBSDKShareKit.framework

I had the same problem, but ran the app on my phone which has facebook installed and it worked.
It might be because it doesn't work on the simulator or facebook has to be installed.
Anyone found anything else?

if you already have items on LSApplicationQueriesSchemes.
let the Facebook items first.
This solved my problem.

From Facebook FAQ at the bottom of the link:
https://developers.facebook.com/docs/ios/ios9
This is an Xcode warning indicating the the canOpenURL: call returned
false. As long as you have configured the LSApplicationQueriesSchemes
entry in your plist as described above, you can ignore this warning

Use like this in info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb123124123123</string>
<string>fbauth2</string>
</array>
</dict>
</array>
After that you should remove your app from editor and launch again.

Related

ITMS-90892: Missing recommended icon error from Apple App Store

I get this error when submitting my app to the App Store recently.
ITMS-90892: Missing recommended icon - The bundle does not contain an alternate app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro. To support older operating systems, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See
It's related to the alternate icons in the app structure and the names I think but has nothing to do with the assets catalog. In my app a user can choose and icon for the Home Screen.
I have 4 icons to choose and 4 sizes for each icon named e.g. - AA_appIcon#2x, AA_appIcon#2x~iPad, AA_appIcon#3x, AA_appIcon83.5#2x~iPad and it used to work fine, but now I get this error for the one name AA_appIcon83.5#2x~iPad.
It is in the correct size 167x167, so not sure what the problem is.
It just happen in the last few days, didn't happen on my previous submission a month ago.
The naming format must have recently changed or something.
Is anyone able to spot the error?
This is the info.plist
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>AA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>Cake</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Cake_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>NA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>NA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>OA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>OA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Cake_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>AA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>Cake</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Cake_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>NA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>NA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
<key>OA</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>OA_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<string>No</string>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Cake_appIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
Here's what you need as of late 2021 if you're getting error ITMS-90890 or ITMS-90892, etc.
File Name
size
IconName#2x.png
120x120
IconName#3x.png
180x180
IconName#2x~ipad.png
152x152
IconName#3x~ipad.png
167x167
*Note the lack of capitalization on ~ipad!
Based on #Warpling answer, here is everything you need to setup alternate icon correctly:
1. Create the icon files
First, you'll have to create a folder named AlternateAppIcons inside your main project (where the info.plist file is located).
Now, inside the folder you've created, add the files with the names and sizes that described in the table:
File Name
Size
IconName#2x.png
120x120
IconName#3x.png
180x180
IconName#2x~ipad.png
152x152
IconName#3x~ipad.png
167x167
I'd recommend you to use Icon Set Creator to generate all sizes, then
Make sure that the file names are exactly the same (case sensitive) after the #.
When you change IconName, make sure to change it as well in the info.plist.
2. Configure info.plist
You'll have to add this to the info.plist:
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>IconName</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>IconName</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array/>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>IconName</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>IconName</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array/>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
3. Change the icon programmatically
All you have to do is to validate that the app supports alternate icons and change it:
guard UIApplication.shared.supportsAlternateIcons else { return }
UIApplication.shared.setAlternateIconName("IconName")
*You may want to create some enum helper like this.
Nevermind
I just renamed the icon from AA_appIcon83.5#2x~iPad.png to AA_appIcon#3x~ipad.png and the error went away and the icon picker still works from within the app.

Custom UTI does not work for iMessage in iOS 10

I defined and used a custom UTI type for my iOS app for iOS 9. Now, after using XCode 8 and iOS 10, I cannot "open" the file, if it is sent via iMessage. If I tap on the icon, nothing happens, although the correct icon is displayed. If it is sent via E-Mail, I can still import it to my app. Is there a difference for mail and iMessage?
My info.plist declarations look like this:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon-60#3x</string>
</array>
<key>CFBundleTypeName</key>
<string>My Voting Lists File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.my-org.document.lists</string>
</array>
</dict>
</array>
and
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>My Voting List File</string>
<key>UTTypeIdentifier</key>
<string>com.my-org.document.lists</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>mylist</string>
</array>
</dict>
</dict>
</array>
I also searched for a solution, but did not find something that works for me.
This stackoverflow discussion did not help me :(
Any ideas what changed or what my mistake is? Thanks in advance!

How to add swift compiler custom flag through XCode templates

I've try to add swift compiler custom flag in target through XCode Templates
Default
<key>Targets</key>
<array>
<dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict/>
<key>Release</key>
<dict/>
</dict>
<key>Name</key>
<string>___PACKAGENAME___</string>
<key>SharedSettings</key>
<dict>
<key>OTHER_SWIFT_FLAGS</key>
<array>
<key>Debug</key>
<string>-DDEBUG</string>
</array>
</dict>
</dict>
</array>
Template
I want to access only debug key. Is it possible?
You were almost there!
This is how the TemplateInfo.plist should look like
<key>Targets</key>
<array>
<dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>OTHER_SWIFT_FLAGS</key>
<array>
<string>-DDEBUG</string>
</array>
</dict>
</dict>
</dict>
</array>
And here is the result

Facebook login on iOS FBSDK

I setup everything same as FB developer page (appId, appName, bundleId...). I work on FBSDK 4.6 and iOS 9. I also already added this key on info.plist.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
However, when running, I received the output error like this:
canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
Anyone know what happened?
For iOS 9 you have add more keys to the info.plist.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
</dict>
</dict>
Facebook getting started
Run the app on your phone to test with Facebook installed. It might be because it doesn't work on the simulator or facebook has to be installed.
i would ignore it.
per their FAQs, facebook acknowledges this and recommends you let it go so as long as you've properly set up their plist settings
Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ?
This is an Xcode warning indicating the the canOpenURL: call returned false. As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning
source: https://developers.facebook.com/docs/ios/ios9

Configure iOS plist so that associated files only open in my App

I have associated a filetype with my iOS app, which works fine. However I want the file type to be exclusive, so that other applications do not offer to 'open in' my file.
I have an app by another developer that does this, but I can't work out how it is done. I have extracted the plist for this app and I cannot see what it is doing to make this happen.
This is what I want to do :
This is what happens in my App:
This is how I have the file associations setup in my plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>abcd</string>
</array>
<key>CFBundleTypeName</key>
<string>My File</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.myapp.abcd</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.myapp.abcd</string>
</array>
<key>UTTypeDescription</key>
<string>My File</string>
<key>UTTypeIconFile</key>
<string>icon</string>
<key>UTTypeIdentifier</key>
<string>com.myapp.abcd</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>abcd</string>
</array>
</dict>
</dict>
</array>
What am I missing?? Does anyone know how to enable this functionality?
Thanks
Duncan

Resources