iOS custom keyboard settings not saving - ios

I’m implementing a settings bundle for a custom keyboard using the Apple Keyboard Extension documentation and the settings tutorial it links to.
This method works in the parent app, but when I implement it as identically as possible for the keyboard extension, the settings bundle does not appear to save any of the data, as shown in this video. It seems as if something is resetting the values near-constantly: any time I exit the settings view (e.g. Multitasking view, previous settings page), the values are set to zero (not default: empty, false, and zero respectively). This is the default settings bundle template, no edits, not referred to in code.
Is there a special implementation for extension settings not explicitly stated in the documentation (or that I missed) that is causing this?
For clarity, the steps I took (after creating the extension):
Created the bundle with New File –> Settings Bundle.
Named it, targeted the keyboard extension.
Built and ran.
These were the same steps I took for the parent app (targeting the app), which was able to save settings.
This is on a physical iOS 11.0 (15A5326a) device; app built with Xcode 9.0 (9M202q), Swift 4.

Related

No complication configuration in xcode for watchOS 9

I added a new watch app for an existing iOS App that is build with react native. I never developed a watch app before. I read everywhere that this should create two targets, the watch App and the App extension. But only a watch app gets created.
Now I want to add a complication for this watch app. I tried to follow the steps here and here. It says that on the general tab of the extension (which is not present in my project) I should configure the Complication Configuration. But this option is just not present.
Was this changed with watchOS 9 or am I missing something else?
I’m having a similar issue after creating a watchOS app in Xcode 13 without an initial complication. Fortunately, I was able to work around the missing configuration UI by manually setting the values.
Assuming you’ve followed these steps of creating the ComplicationController class and “Complication” placeholder in Assets,
Go to Project -> watch app target -> Build Settings
Set “Complication Principal Class” to $(PRODUCT_MODULE_NAME).ComplicationController under Info.plist Values
Set “Watch Complication Name” to Complication under Asset Catalog Compiler - Options

App settings not present in system settings in iOS

I've created a flutter app. One of the functionalities I'm creating requires location access and once the user denies the permission there's no way to enable it manually and system doesn't display dialogs on subsequent requests.
The reason it can't be done manually is that there's no application entry in system settings (at least in iOS simulator - that's the only iOS instance I can test on myself). What do I do to make it appear?
iOS uses settings bundle to display applications in system settings. Turns out Flutter is not creating it upon project creation.
In order to create it:
Open ios folder in xcode
Open Runner entry in the project view, it should contain a bunch of folders, one of which is Runner again
Right-click the inner Runner entry
Select New file...
Select Settings Bundle and confirm the selection (then press create with default settings)
Open Root.plist file and remove all Preference Items so that the array is empty
Once you reinstall the app, an entry in settings should appear. Once you request some permission (e.g. location) and deny/approve it, it should be automatically added there.

Will the Main Interface be automatically mapped to my iPad storyboard during deployment?

I'd like to deploy my first Universal app with an iPad specific version to the app store. Everything works well in Xcode, I'm able to manage 2 separate storyboards via my info.plist using the following entries:
Main storyboard file base name: Main.storyboard
Main nib file base name (iPad): Main-ipad.storyboard
Then in my Deployment Info I usually switch the Main Interface (manually) back and forth between Main and Main-ipad for development purposes.
Though, what will happen when I'll submit my app (binary) to the app store? Will the Main Interface be automagically switched based on the user device or do I have to programmatically switch the value based on the current device? So that the iPad gets the right Main Interface as well as the iPhone.
Alright - I finally worked that out. Here are the clear and simple steps that you need to follow in order to either: convert an iPhone app into a universal app, or to simply package your universal app prior to submitting the build to the App store:
Make sure you select "Universal" for devices in your project Deployment info under the General tab.
Create a XIB file (=storyboard) for the iPad. You can either copy past the iphone one or start from scratch. Name it something like "Main-ipad.storyboard" for example.
Now you need to manually do a bunch of stuff which I don't really understand why xcode does not do it automatically for us since they've introduced that "universal" project thing.
3.1 Go to your info.plist file and add the following entry to tell your project that you're using a seperate storyboard for the iPad. Add "Main storyboard file base name (iPad)" as a key and then your XIB file name "Main-ipad" without any extension.
3.2 Make sure you have the original XIB file (iphone) well setup. It should be "Main storyboard file base name" and the value something like "Main".
Now try to run your app in the simulator on iphone and then ipad see if it picks up the right storyboard.
Done!
Notes: Make sure to select the right key because I had "Main nib file base name..." instead of "Main storyboard file base...". This was generating errors when I was trying to archive and submit the build to the app store even though it was working fine in xcode!

User-Defined settings for WatchKit

I am using User-Defined settings (for example CustomAppBundleId) to change bundle identifier for different configurations. In the app’s plist file I set CFBundleIdentifier to ${CustomAppBundleId}. For Release configuration I use bundle:
com.yourcompany.${PRODUCT_NAME:rfc1034identifier}
and for AdHoc I use:
com.yourcompany.adhoc.${PRODUCT_NAME:rfc1034identifier}
Now I added WatchKit Extension and WatchKit App. For WatchKit Extension bundle identifier I can use the same approach. I also have to change WKAppBundleIdentifier to match the bundle identifier in the WatchKit App. Again, I could use User-Defined settings. Now the last bit is WatchKit App. Unfortunately WatchKit App doesn’t have an option to add User-Defined settings but I need to set the right values for CFBundleIdentifier and WKCompanionAppBundleIdentifier (that is equal to CustomAppBundleId in the app). Is there any way I can do it? Or should I use different approach?
Define your "User-Defined" variables in project's Build Settings rather than in target's. That way you will have the same user defined variables automatically available (inherited) in WatchKit Extension and App target.
Btw make sure you have the latest Xcode 6.3 from the App Store. This version (and most recent Xcode 6.3 beta 4) already allow you to define custom "User-Defined" in Build Settings).
Previous versions were simply missing "Build Settings" tab in WatchKit App target, but if you were brave enough, you could have modify those manually in plain text editor :-)
Update to Xcode 6.3.
In 6.3 you will have additional tabs for target configuration that should provide what you need.
But I'm almost sure you will face issues with the WatchKit App Storyboard.
In the Scenes > Identity Inspector > Custom Class you have to set the correct module - that is not possible if you have more than 1 (if you do not have more than one I would be more than interested in your setup)
I solved that issue with a pre-action script that updates the storyboard XML accordingly

info plist seems outdated and cannot validate App with App Store

I took a project I did recently where the app was universal and I copy-pasted the project. With the copy, I've done a Lite version where I don't support iPad.
I've changed everything I think necessary to make this project as unique, independently that it was a copy from another project: changed the bundleID (matches with the first version on the store), project name, display name, etc. I've removed the iPad storyboard and all the iPad icons. I've also removed the iPad icons from the plist.
Now the App is ready to go and i'm trying to validate it with Apple. Then it gives me the following error:
Icon specified in the Info.plist not found under the top level app wrapper: Icon-72#2x.png (-19007)
but for all the "missing" icons. Before I tried to validate, the debugger said nothing but after the validation attempt, it now give me 6 warnings, which say the same as the error above. One warning per "missing Icon".
I've tried to delete derived data from xcode, clean the project, restart Xcode, etc. But it keeps telling me the same.
Any idea? Thanks in advance!
If you change from universial to iPhone-only via project interface, the iPad-Icon and the iPad-Storyboard are still in the info.plist.
Just open the info.plist as Propertylist and delete the wrong entries.

Resources