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
- resourcesUrl is in different folder, one i cannot find on finder
- bundle is nil
- path is obviously nil
- didReceiveMessage delegate call this code NOT on main thread (so I dispatch on main)
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