简体   繁体   中英

Linker errors from Xcode 9.2 Objective-C with WCSession

I am adding a watch capability to an existing fairly complex Objective-C iOS application (that I have inherited), but am getting an unexpected build error right from the start.

ld: warning: directory not found for option '-L/Users/mac/Documents/raceQs-iOS/ios/raceqs_pod/Library' ld: warning: directory not found for option '-L/Users/mac/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Release-iphoneos' ld: warning: directory not found for option '-L/Users/mac/Documents/raceQs-iOS/ios/raceqs_pod/Pods/build/Debug-iphoneos' Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WCSession", referenced from: objc-class-ref in MainClass.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

The error is generated when I add the following code to my Main class:

#import <WatchConnectivity/WatchConnectivity.h>
@interface MainClass ()<WCSessionDelegate>
@end

and

if ([WCSession isSupported]){
//     WCSession *session = [WCSession defaultSession];
  //      session.delegate = self;
  //      [session activateSession];

    }

I have researched the issue, and I think it's a problem with my build settings Library Search Paths which are: 图书馆搜索路径

Any suggestions would be gratefully received.

Fixed

Added WatchConnectivity.framework to Build Settings/Link Binary With Libraries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM