Updating existing Watchkit app to WatchOS2 - watchkit

Yesterday I saw this post and made me realize I have a problem.
I have created an WatchOS2 app after having an WatchOS1 app in the store. When I tried to run the app it made me upgrade my bundle identifier name and now I have no idea if I will be able to submit my WatchOS2 app with a different bundle identifier. Does app store support two different bundle identifier for watch apps?
EDIT
With watchOS1 I had the following bundles:
|App | my.app.com |
|Watch | my.app.com.watchkit |
|Watch Extension | my.app.com.extension |
And now, with watchOS2 I need to have the following:
|App | my.app.com |
|Watch | my.app.com.watchkit |
|Watch Extension | my.app.com.watchkit.extension | <- The difference
Can I submit with this difference?

From the watchOS 2 Transition Guide:
The base bundle identifier of all your watch targets must be identical to the bundle identifier of your iOS app. This behavior applies even when you have separate targets for both watchOS 1 and watchOS 2. The only differences between the bundle identifiers of any of the targets is the extensions that Xcode adds to identify the Watch app and WatchKit extension. iOS does not install Watch apps whose bundle identifier does not match the bundle identifier of its iOS app.
Also you can check the Lister application to see all the new stuff Apple has implemented for Watch including the backward compatibility with watchOS 1.
Update for clarity:
Here are bundle IDs for the watch app and watch extension respectively from the Lister app:
watchOS 1:
com.example.apple-samplecode.Lister.watchkitapp
com.example.apple-samplecode.Lister.watchkitextension
watchOS 2:
com.example.apple-samplecode.Lister.watchkitapp
com.example.apple-samplecode.Lister.watchkitapp.watchkitextension
The conclusion: As far as you see your bundle IDs naming is absolutely correct and feel free to submit your app.

Related

Setup Firebase Remote Config

I want to use Remote Config in a application Xamarin.Forms.
I use a blog - Firebase Remote Config in Xamarin Forms
I have a question about the section: Setup Firebase Remote Config.
Quote
We can setup Firebase Remote Config through the Firebase portal https://console.firebase.google.com/project/Your-Firebase-Project/config and it is an easy process because the portal GUI is nice and friendly. To do it, we add a new parameter key and the default value and of course it can be a json (the GUI has a tool to validate the format of the json content). In the example case the key will be Features and the default value a json:
{
"ShowPlayerDetail": false
}
In this case, we setup a key called ShowPlayerDetail to show or not the player detail.
Question:
Where is the JSON file referred to in this section?
Note.
I am currently in a project.
Update-1
Update-2
Update-3
Update-4
Update-5
I have completed the following steps.
Did I do the right thing?
Do my actions correspond to what is described in the blog?
Or do I need to perform Publish changes? (see Pic-4. Result)
Pic-1
Pic-2
Pic-3
Pic-4. Result
You're using an existing Firebase project but there are no apps in your project, please see the Update-4 screenshot .
You could click the iOS or Android icon to add app to your Firebase project, and make sure the Apple bundle ID matches the Bundle identifier in info.plist of your Xamarin.iOS project, the Android package name matches the packagename in AndroidManifest.xml of your Xamarin.Android project. After registering the app, you can download the google-services.json file for Android and the GoogleService-Info.plist file for iOS.

Will I have problems if I publish an app with a packagename different of bundle id?

Recently I had to change the package name of my android project because I had to disable an old app to change some pieces of information and some of the UI of it. But the business logic are pretty the same. So I wonder, can I use the same solution with a different package name for Android (for create another app in google play with the same name but different package name) and then keep the bundle id the same for iOS to not have to recreate another one in the app store? Will I have problems with it?
Thanks very much.
In my knowledge, there should not be any issues if you make sure about the following pointers:
Everything that was registered on the old bundle id is now registered for the new one and replaced with the new one all over your project. eg: if you have a firebase product used then you replace the old googleservices.json with the new one.
The old app that you have on the store is removed(To avoid confusion for users)
You can use the same key to sign the key but you cannot use the same App that you added on store earlier.
Make sure you do not have any dependency of any sort on the old bundle id.
Note: Your old app will not be replaced by this new one even though they would have the same name as the bundle id is the unique identifier for this.
There should not be any problems if you use the same bundle id for the new iOS app as you had earlier but usually, both apps have the same bundle just to keep it standard. But you can always opt. not to.
Goodluck feel free to get back if you have any more queries

Firebase Analytics (Two projects) for single app

I want to use TWO Firebase Analytics for one single app, one single code.
Project 1: Firebase Analytics Test Project
Project 2: Firebase Analytics Prod Project
How can I add two google-services.json file in one single project. Is there any other way to use the same.
Analytics works with only 1 Google App ID in your GoogleService-Info.plist. There is no way to send traffic to both projects. I'd recommend to have 2 separate projects for test and release versions. It's not recommended to mix up Test data with Production data as it is confusing and Production data may not reflect the real behaviors if test data is in it. For example, if you run Test app every night by installing and uninstalling, it may appear that you have a new user every day in your production app.
One thing you can do is having a GoogleService-Info.plist for the release but use the run-time APIs to use the custom FIROptions
-[FIROptions initWithContentsOfFile:(NSString *)plistPath]
where plistPath is the path to the custom GoogleService-Info.plist, say CustomGoogleService-Info.plist. Or
- (instancetype)initWithGoogleAppID:(NSString *)googleAppID
bundleID:(NSString *)bundleID
GCMSenderID:(NSString *)GCMSenderID
APIKey:(NSString *)APIKey
clientID:(NSString *)clientID
trackingID:(NSString *)trackingID
androidClientID:(NSString *)androidClientID
databaseURL:(NSString *)databaseURL
storageBucket:(NSString *)storageBucket
deepLinkURLScheme:(NSString *)deepLinkURLScheme;
In this way, you can put it under the compiler flag for testing version. In the release, the compiler flag will remove that line and use the correct GoogleService-Info.plist for the release version.
For example:
#ifdef TESTING
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:pathToCustomPlist];
[FIRApp configureWithOptions:options];
#endif // TESTING

How does watchOS find the main storyboard file?

I would like to have two storyboard files for feature flag reasons. Only one will be used at a time, but I want to have two files for switching back and forth between builds. However, I cannot find where watchOS determines which storyboard file to load.
iOS has a key UIMainStoryboardFile in Info.plist. But watchOS has no such key.
When I check our current Watch Extension and Watch App targets in both the General and Info sections, I see no mention of storyboard files.
Note that watchOS does have WKExtensionDelegateClassName key for Info.plist, which will also serve my feature flag purpose. However, no code in my WKExtensionDelegate specifies a particular storyboard.
In Xcode, when I look at the current watch storyboard file in the File Inspector right pane, I see no special indicator marking for initial storyboard. Just in case it was listed there.
The App Programming Guide for watchOS does not explain how the connection is made either.
Any ideas?
So after much experimenting:
Conclusion:
I cannot have mutually exclusive Storyboards in watchOS.
watchOS seems to merge all storyboards into one thing.
So when you reference a WKInterface​Controller by name, watchOS just picks the right storyboard.
To feature flag storyboard scenes, just make sure you don't load the wrong one.
Evidence
Building watchOS app extension fails with errors if more than one interface controller is designated "Is Initial Controller" across multiple storyboards. The error is:
Multiple main entry points were specified. Please designate a single interface controller as the entry point of your watch application.
I devised the following scenario and it worked:
Main.storyboard with interface controller identifier "Bobby".
Main2.storyboard with interface controller identifier "Sue".
Main2.storyboard interface controller Sue "Is Initial Controller".
Bobby has button which calls WKInterfaceController.reloadRootControllers(withNames: ["Sue"], contexts: nil)
Button works as expected and loads Sue interface controller scene from Bobby.

How to update Watch app with updates in core data?

We support iOS 7, so I am not using a framework. The app is mostly objective-c, and the watchkit extension mostly in swift. The AppDelegate manages the Core Data objects.
Our app allows the user to choose a configuration to change what they see. They can switch to a different configuration. When they switch, we remove most everything from NSDefaults and we remove the sqlite database and recreate it. When they switch, its basically starting over.
On the watch side, I have a swift class that has a lazy loaded Singleton of an object that manages the core data objects. But when the app resets its data, how can we report this out to the watch extension? I am guessing that I have to reset the managed object context that the extension created.
You can use MMWormHole to send messages from your iPhone app to your WatchKit extension. In your WatchKit extension you can set the stalenessInterval for your Core Data database to something really short and you will also probably want to refresh your NSManagedObjects.

Resources