简体   繁体   English

Xcode 9.2 Objective-C与WCSession的链接器错误

[英]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. 我向现有的相当复杂的Objective-C iOS应用程序(我继承了)添加了监视功能,但是从一开始就遇到意外的构建错误。

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) ld:警告:找不到选项'-L / Users / mac / Documents / raceQs-iOS / ios / raceqs_pod / Library'的目录ld:警告:找不到选项'-L / Users / mac / Documents / raceQs-的目录iOS / ios / raceqs_pod / Pods / build / Release-iphoneos'ld:警告:找不到选项'-L / Users / mac / Documents / raceQs-iOS / ios / raceqs_pod / Pods / build / Debug-iphoneos'的目录体系结构arm64的符号:“ _ OBJC_CLASS _ $ _ WCSession”,引用自:MainClass.o中的objc-class-ref ld:体系结构arm64的符号找不到clang:错误:链接器命令失败,退出代码为1(使用-v参见调用)

The error is generated when I add the following code to my Main class: 当我将以下代码添加到我的Main类时,将生成错误:

#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 添加了WatchConnectivity.framework以构建设置/使用库链接二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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