Realm-cocoa: Unable to setup realm for watchkit using cocoapod

Created on 8 Dec 2015  路  7Comments  路  Source: realm/realm-cocoa

I tried to use Realm.framework for both of my ios app and ios watch kit. I tried many ways, none of them work. Could anyone give me an example of how to write a pod file to share a framework between ios app and watch app?

With out any watch extension target in pod file, I got an error saying:

Target 'Realm' of project 'Pods' was rejected as an implicit dependency for 'Realm.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
Target 'RealmSwift' of project 'Pods' was rejected as an implicit dependency for 'RealmSwift.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
Target 'Pods' of project 'Pods' was rejected as an implicit dependency for 'Pods.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'

Then I added target for watch extension to my pod file. Here is my pod file:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
link_with 'myApp', 'myApp Watch Extension'

def shared_pods
  pod 'RealmSwift'
end

target 'myApp' do
    podspec :path => 'myapp.podspec'
    pod 'SnapKit'
    pod 'ChameleonFramework/Swift'
    pod 'Google-Mobile-Ads-SDK'
    shared_pods
end

target 'myApp Watch Extension' do
    podspec :path => 'myapp.podspec'
    platform :watchos, '2.0'
    shared_pods
end

I got it run with warnings with "pod install", but my workspace failed to run.

2015-12-07 15:45:46.402 ruby[17042:4339468] warning:  The file reference for "Realm.framework" is a member of multiple groups ("Products" and "Products"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
2015-12-07 15:45:46.402 ruby[17042:4339468] warning:  The file reference for "RealmSwift.framework" is a member of multiple groups ("Products" and "Products"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.

There are so many errors in my Pods-myApp Watch Extension-Realm file.
Could anyone show me how it should be done?

T-Help

Most helpful comment

This problem is about a platform mess. Fixed by removing or commenting the platform :ios, '9.0' line of the Podfile.

All 7 comments

I just bumped into the same issue. Would be great to get some feedback how to build Realm via CocoaPods for WatchOS2

@xiongemi It seems that your Podfile should work.
Can you try COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=YES pod install ?

@xiongemi and @DaGaMs, can you please try again with CocoaPods 0.39.0 with both pod install and COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=YES pod install? Thanks!

@xiongemi and @DaGaMs have you had the chance to try my latest recommendation? I'd love to know if there's any more we can do to help here.

@jpsim sorry, I don't actually have that problem any more. Unfortunately, I can't remember for the life of me how I fixed it. I _think_ in the end I just needed to upgrade cocoapods to 0.39.0 and that was it...

Thanks for following up! That lines up with our expectations as well, so I'm closing this issue.

This problem is about a platform mess. Fixed by removing or commenting the platform :ios, '9.0' line of the Podfile.

Was this page helpful?
0 / 5 - 0 ratings