How to add swift compiler custom flag through XCode templates - ios

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

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.

UTImportedTypeDeclarations are not working as expected

I am trying to add OPML import/export option to my app. Experiencing the following problems:
1) Importing OPML is working correctly until I install any other app that uses OPML. Files become "greyed out" and unavailable
2) icons for OMPL files are not showing despite assets are set up (both 22x29 and 44x58 pixels)
Using the code below added in Info.plist:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>icon_44x58</string>
<string>icon_22x29</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.tuneVu.opml</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>opml</string>
<key>public.mime-type</key>
<string>text/x-opml</string>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>icon_44x58</string>
<string>icon_22x29</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.tuneVu.opml</string>
<key>UTTypeReferenceURL</key>
<string></string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>opml</string>
<key>public.mime-type</key>
<string>text/x-opml</string>
</dict>
</dict>
</array>

Facebook SDK 4.5 IOS 9

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.

only group titles showing in iOS settings bundle child pane

I'm about to make a settings for graphical stuff in a separate .plist. I have linked it from the Root.plist, but only the device only shows the group titles. Because i can't upload the images I paste the code here.
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Graphics</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Background Settings</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Moving background</string>
<key>Identifier</key>
<string>moveEnabled</string>
<key>Default Value</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Display Nebulas</string>
<key>Identifier</key>
<string>nebulasEnabled</string>
<key>Default Value</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Display Stars</string>
<key>Identifier</key>
<string>starsEnabled</string>
<key>Default Value</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Explosion Settings</string>
</dict>
</array>
</dict>
</plist>
This is the part, where only titles shows, and this is how I linked it:
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Graphic Settings</string>
<key>File</key>
<string>Graphics</string>
</dict>
Thanks for help.
make sure none of the elements in the PreferenceSpecifiers's array are missing a "required" key/value pair.
You can find Apple's reference for every shema element here.
I had the same issue, it worked for me!

App settings, specifically Root.plist got corrupted. Why?

My app started crashing mysteriously today, when running via Xcode. I tracked the problem to the settings not being available, and in fact, looking at the settings app for my app, I see:
Going to my Settings.bundle in Xcode, specifically Root.plist, I get this error message:
So, the file has been corrupted. Disturbing, but not too worrisome. I get a copy of the file from last night (thanks TimeMachine). I do a diff between that file and the one I have now, and I see no difference. I go back a few days until I find a version that is different. Unfortunately that was when I seriously revamped the root.plist file, so I can't find anything corrupted in the latest version.
Also, the app only crashes on a new iPhone where my app was never installed before. My other iPhones don't crash when running the same app via Xcode, but all show an empty Settings window as in the screenshot above. I think that maybe despite the corrupted root.plist, the actual NSUSerDefaults are still on the iPhones that at one point had a non-corrupt root.plist, but on the new iPhone there is no NSUSerDefaults, which leads to some bad things in my app.
Here is my plist content. Can you spot anything that is corrupted? Thanks. (I already checked SO: Empty Settings Bundle in Xcode 4.2 and it doesn't help.)
<?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>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Initial Magnification</string>
<key>Values</key>
<array>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
</array>
<key>Titles</key>
<array>
<string>1x</string>
<string>2x</string>
<string>3x</string>
</array>
<key>Key</key>
<string>LuminInitialMagnificationKey</string>
<key>DefaultValue</key>
<integer>2</integer>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Large Lock Button</string>
<key>Key</key>
<string>LuminLockButtonEmphasis</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Picture-in-Picture Frame</string>
<key>Key</key>
<string>LuminOutlineEnabled</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Sound</string>
</dict>
<dict>
<key>DefaultValue</key>
<false/>
<key>Key</key>
<string>LuminFocusBeepKey</string>
<key>Title</key>
<string>Focus Beep</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Share Options</string>
</dict>
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Mail</string>
<key>File</key>
<string>EmailSettings</string>
</dict>
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Tweet</string>
<key>File</key>
<string>TweetSettings</string>
</dict>
<dict>
<key>Type</key>
<string>PSChildPaneSpecifier</string>
<key>Title</key>
<string>Facebook</string>
<key>File</key>
<string>FacebookSettings</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>History</string>
<key>FooterText</key>
<string>Tagged images will not be deleted. Dropbox mirroring is queued until WiFi connectivity is available.</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Delay Before Saving</string>
<key>Values</key>
<array>
<string>1</string>
<string>3</string>
<string>5</string>
<string>7</string>
</array>
<key>DefaultValue</key>
<string>3</string>
<key>Titles</key>
<array>
<string>1 second</string>
<string>3 seconds</string>
<string>5 seconds</string>
<string>7 seconds</string>
</array>
<key>Key</key>
<string>LuminTimeToWaitBeforeHistoryKey</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Number of Images to Keep</string>
<key>Key</key>
<string>LuminNumberOfHistoryFilesKey</string>
<key>DefaultValue</key>
<string>100</string>
<key>KeyboardType</key>
<string>NumberPad</string>
</dict>
<dict>
<key>DefaultValue</key>
<false/>
<key>Key</key>
<string>LuminDropboxActive</string>
<key>Title</key>
<string>Mirror to Dropbox</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>FooterText</key>
<string>Lumin™ © 2011-2012 M. Zabetian & BitsOnTheGo.com. All rights reserved. Special Thanks to Tim Smith and AppliedDesign.tv.</string>
</dict>
<dict>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>DefaultValue</key>
<string>Unknown</string>
<key>Title</key>
<string>Version</string>
<key>Key</key>
<string>AppVersionStringKey</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
I have resolved this. I replaced
Zabetian & BitsOnTheGo.com
with
Zabetian and BitsOnTheGo.com
I had to use another text editor as Xcode wouldn't open the file as it claimed it was corrupted. After replacing that ampersand, Xcode could open it and I could build and run my app and see the full Settings pane.
Not sure if this counts as a bug in Xcode or not. Depends whether it is legal to have "&" and characters like it in a settings plist. Not sure why it wouldn't be.

Resources