tvOS 上的 GCDWebServer
GCDWebServer on tvOS
有人设法在 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 没有的框架用法?它可以修复吗?我很乐意研究它,但如果有人已经知道它,我将省去重复工作的麻烦...
GCDWebServer 基于 tvOS 构建,latest pre-release version 有一个示例 tvOS 项目。
如果您使用 CocoaPods 或 Carthage 并将其配置为指向 master
而不是 3.x
,它应该可以工作。
Yep.Finally 我找到了这个问题的解决方案。
BTW.I 使用 Cocoapods 在我的项目中安装 GCDWebServer 并使用 [=70= 构建我的电视应用程序] 应用在一起,但它们是不同的目标。
在我的例子中,我使用 Objective-C 编写我的 phone 应用程序并使用 Swift 来写电视 app.So 我应该将 桥接头 添加到我的电视目标。
TARGETS > YOUR-TV-TARGET > Build Settings > Swift Compiler > Objective-C Bridging Header > 添加这个
$(SRCROOT)/YOUR-TV-PROJECT/YOUR-PROJECT-MODULE-Bridging-Header.h
然后我在我的项目中创建这个头文件并添加
#import <GCDWebServer/GCDWebServer.h>
#import <GCDWebServer/GCDWebServerDataResponse.h>
如何在 Swift 和 Objective-C 之间架起一座桥梁,你可以按照这个 link :
然后我遇到了这个问题
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 我转到 TARGETS > YOUR-TV-TARGET > Build Phrase > Link Binary With Libraries 和添加这些框架等:
libxml2.2.tbd
libz.1.2.5.tbd
CFNetwork.framework
MobileCoreServices.framework
UIKit.framework
这是我的 TV-TARGET 的 Build Phases。我们还应该查看 Pods > GCDWebServer > Build Settings etc.Because 它在 Pods,所以我们必须编辑 Podfile 并重建我的 project.This 是 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-TARGET 中调用 GCDWebServer,在您的 tvOS 中也可以调用 GCDWebServer 运行。 :-)
希望对您有所帮助。
有人设法在 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 没有的框架用法?它可以修复吗?我很乐意研究它,但如果有人已经知道它,我将省去重复工作的麻烦...
GCDWebServer 基于 tvOS 构建,latest pre-release version 有一个示例 tvOS 项目。
如果您使用 CocoaPods 或 Carthage 并将其配置为指向 master
而不是 3.x
,它应该可以工作。
Yep.Finally 我找到了这个问题的解决方案。
BTW.I 使用 Cocoapods 在我的项目中安装 GCDWebServer 并使用 [=70= 构建我的电视应用程序] 应用在一起,但它们是不同的目标。
在我的例子中,我使用 Objective-C 编写我的 phone 应用程序并使用 Swift 来写电视 app.So 我应该将 桥接头 添加到我的电视目标。
TARGETS > YOUR-TV-TARGET > Build Settings > Swift Compiler > Objective-C Bridging Header > 添加这个
$(SRCROOT)/YOUR-TV-PROJECT/YOUR-PROJECT-MODULE-Bridging-Header.h
然后我在我的项目中创建这个头文件并添加
#import <GCDWebServer/GCDWebServer.h>
#import <GCDWebServer/GCDWebServerDataResponse.h>
如何在 Swift 和 Objective-C 之间架起一座桥梁,你可以按照这个 link :
然后我遇到了这个问题
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 我转到 TARGETS > YOUR-TV-TARGET > Build Phrase > Link Binary With Libraries 和添加这些框架等:
libxml2.2.tbd
libz.1.2.5.tbd
CFNetwork.framework
MobileCoreServices.framework
UIKit.framework
这是我的 TV-TARGET 的 Build Phases。我们还应该查看 Pods > GCDWebServer > Build Settings etc.Because 它在 Pods,所以我们必须编辑 Podfile 并重建我的 project.This 是 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-TARGET 中调用 GCDWebServer,在您的 tvOS 中也可以调用 GCDWebServer 运行。 :-)
希望对您有所帮助。