Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watch app shared across multiple targets

My project has multiple build targets so I can facilitate "branded" builds that share the same code, but have unique bundle identifiers and assets per target. I've created a watch app for one of my app targets, which is working just fine. Now I'm trying to use the same watch app and extension for my other targets. I thought I could easily duplicate the watch targets (watch and extension) and simply change all the bundle id references to match the other targets but it seems like theres a hidden reference some where.

I just want to use one watch app for all my different branded targets.

Side note: the watch apps also would need to be branded correctly (asset folders).

Any ideas? Thanks.

Solution update

So, I solved it. When I duplicated my watch targets (watch and extension), and changed the bundle ids, target dependencies, everything to make it identical to the old target (but of course pointing to the new targets), for some reason the new watch target didn't point to the correct watch extension target. And there was no way to change it, anywhere. I tried to re-duplicate the targets and still had the same issue.

So what I did was to open the project.pbxproj file, search for any references to my watch extension (and bundle id) and manually update the connections. My watch target had a dependency to the wrong watch extension, and the new watch extension had a pointer to the old watch extension somehow. I later also found out I had to point the build to the correct productreference (appex reference) since this too was wrong.

So the new watch target, pointed to the wrong watch extension, and the correct watch extension pointed to the wrong appex (output file). All of this I had to change manually in the project file. It sounds extreme and hard, but it actually wasn't that difficult once you kept notes of the different UUIDs.

I hope this helps someone else who might stumble upon the same weird issue.

like image 408
tskulbru Avatar asked Dec 01 '15 14:12

tskulbru


People also ask

Can Apple Watch have two users?

Apple Watch does not support more than one user profile or iPhone pairing at any given time.

Can Apple Watch be shared?

With Family Setup, your family member who doesn't have their own iPhone can use their Apple Watch to do things like make phone calls, send messages, and share their location with you. After you set up a watch for a family member, you can use your iPhone to manage some of the watch's capabilities.

How do I add people to my Apple Watch?

Add or remove a friend Open the Activity app on your Apple Watch. Swipe left, then turn the Digital Crown to scroll to the bottom of the screen. To add a friend, tap Invite a Friend, then tap a friend. To remove a friend, tap a friend you're sharing with, then tap Remove Friend.


1 Answers

You can use one target by creating Environment Variables to the projects and assigning in the plist files like images attached below.

Watch Extension ExtensionPlist

Also, you can do all the branding in the code depending on the bundle identifier by having helper like this

extension AppInfo {
    static var develop: Bool {
        return (self.CFBundleIdentifier?.contains("Dev") ?? false)
}

like image 182
mert Avatar answered Oct 04 '22 19:10

mert