有人能在tvos上使用GCDWebServer吗?我试着用Xcode 7.1编译,我得到了:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GCDWebServer", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_GCDWebServerDataResponse", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_GCDWebServerRequest", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)在GCDWebServer中是否有一些tvOS没有的框架的用法?能修好吗?我很乐意调查这件事,但如果有人已经知道这会省去我重复工作的麻烦.
发布于 2016-04-28 10:08:29
Yep.Finally我找到了这个问题的解决方案。
我用Cocoapods在我的项目中安装了GCDWebServer,我用我的手机应用程序构建了我的电视应用程序,但它们是不同的目标。
在我的例子中,我使用Objective编写我的手机应用程序,使用Swift编写tv app.So,我应该在我的电视目标中添加桥接头。
目标>你的电视-目标>构建设置>快速编译器>目标-C桥接头>添加以下
$(SRCROOT)/YOUR-TV-PROJECT/YOUR-PROJECT-MODULE-Bridging-Header.h然后在我的项目中创建这个头文件并添加
#import <GCDWebServer/GCDWebServer.h>
#import <GCDWebServer/GCDWebServerDataResponse.h>如何在Swift和Objective之间架起一座桥梁,您可以遵循以下链接:
然后我遇到了这个问题
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GCDWebServer", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_GCDWebServerDataResponse", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_GCDWebServerRequest", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)我认为这可能是我的building.Maybe的一些问题,有些库是missing.So,我转到目标>你的电视-目标>构建短语>链接二进制与图书馆,并添加这些框架,等等:
libxml2.2.tbd
libz.1.2.5.tbd
CFNetwork.framework
MobileCoreServices.framework
UIKit.framework这是我的电视-目标的构建阶段,.We也应该查看Pods > GCDWebServer > Build Settings etc.Because,它在Pods中,所以我们必须编辑Podfile并重建my project.This is Podfile.You,应该在Podfile中分离目标。
source 'https://github.com/CocoaPods/Specs.git'
def common_pods
pod 'Fabric' , '~> 1.6.4'
end
def tv_pods
pod 'GCDWebServer' , '~ 3.3.2'
end
target :phoneApp do
link_with 'YOUR-PHONE-TARGET'
platform :ios, '8.0'
common_pods
end
target :tvApp do
link_with 'YOUR-TV-TARGET'
platform :tvos, '9.0'
tv_pods
end编辑Podfile并运行之后:
pod install 您可以在TV中调用GCDWebServer,GCDWebServer在tvOS中运行良好。:-)
希望它能帮到你。
发布于 2015-11-17 03:08:25
GCDWebServer构建在tvOS上,最新预发行版有一个示例tvOS项目。
如果您使用CocoaPods或Carthage并将其配置为指向master而不是3.x,那么它应该可以工作。
https://stackoverflow.com/questions/33450768
复制相似问题