In my application i use a static library with resources target, I've connected the resources target to Build Phases -> Copy Bundle Resources
and i fetch library resources like this:
NSUrl *resourcesUrl = [[NSBundle mainBundle] URLForResource:@"MySDKResources" withExtension:@"bundle"]
NSBundle *bundle = [NSBundle bundleWithURL:resourcesUrl];
NSString *path = [bundle pathForResource:filename ofType:fileExtension];
Using watch extension, when application receive func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void)
delegate I use the same code but this time
In the same session when one of application classes call this code file path return alright but when watch extension delegate call the same code it returns nil
I've tried to add the static library to Target Dependencies
and Compile Sources
and adding the resources target to Copy Bundle Resources
but i get No such file or directory error
Ok, turns out that when you run watch simulator it kills app on iPhone simulator (but not crash it) so it seems like the app running but actually you cannot instantiate bundle or any other app resource. this blog post explain how to run application and watch application together on debug.
TL;DR :
while running code on simulator on Xcode menu bar select Debug -> Attach to Process -> select the process of your iOS app from the list (It'll probably be under Likely Targets)