NachoSoto
NachoSoto

Reputation: 1743

Linking dual (iphoneos and watchos) frameworks with same product name

I recently had to duplicate my own frameworks to be able to link them from the native watchOS 2 extension, because the platform is different. So for every framework X I have an X-watchos counterpart. Everything works fine in the simulator and when building directly to my devices, and it wasn't until I tried to archive that I got this linking error:

Linking error

I ran lipo -i on the built watchOS framework and sure enough, its archs are arm7 and arm64 instead of armv7k.

When I looked further into the built directory I noticed this:

Derived data structure

Both versions are symlinks to the same file, and because the have the same product name, they're being overridden. I could make them have different names, but that would make importing them really cumbersome.

Note that this is not a problem for 3rd-party frameworks because Carthage is already building them in separate directories.

EDIT 08/22/2015: I've filed a radar with a sample project: http://www.openradar.me/22392501

EDIT 08/24/2015: This has been acknowledged in Xcode 7 Beta 6 release notes as a known issue:

known issue

EDIT 09/9/2015: Xcode 7.1 Beta release notes hint that this is fixed, but I haven't confirmed it yet.

Upvotes: 13

Views: 754

Answers (2)

Porter Hoskins
Porter Hoskins

Reputation: 581

This is working for me in Xcode 7.1.

Upvotes: 1

CarlosGz
CarlosGz

Reputation: 396

I’m using a similar configuration with my own frameworks, but I set a different name when creating it in each platform (MyFramework and MyFramework-watchOS). Don't forget to set a common product name manually (mine is MyFramework on both) in the build settings tab of each framework.

Upvotes: 0

Related Questions