iOS SDK Hue Philips与Swift [英] iOS SDK Hue Philips with Swift
问题描述
我尝试在Objective C中为Hue导入iOS SDK。
I tried to import iOS SDK in Objective C for Hue.
我按照以下说明操作: https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX
I followed instructions here : https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX
我添加了HueSDK_iOS .framework到我的项目,我添加了所有Lumberjack文件,我用导入行创建了.h。
I added the HueSDK_iOS.framework to my project, I added all Lumberjack files and I created the .h with the import line.
之后,我在我的代码中使用了:
After, I used in my code :
var phHueSdk : PHHueSDK = PHHueSDK()
var searching : PHBridgeSearching = PHBridgeSearching()
我有这样的错误:
架构armv7k的未定义符号:_ OBJC_CLASS _ $ _ PHHueSDK,
引自:
InterfaceController.o中的__ObjC.PHHueSDK的类型元数据访问器_OBJC_CLASS _ $ _ PHBridgeSearching,引用
from:
type metadata accessor for在InterfaceController.o中的__ObjC.PHBridgeSearching ld:找不到架构师的符号ure armv7k
clang:错误:链接器命令失败,退出代码为1(使用-v查看
调用)
Undefined symbols for architecture armv7k: "_OBJC_CLASS_$_PHHueSDK", referenced from: type metadata accessor for __ObjC.PHHueSDK in InterfaceController.o "_OBJC_CLASS_$_PHBridgeSearching", referenced from: type metadata accessor for __ObjC.PHBridgeSearching in InterfaceController.o ld: symbol(s) not found for architecture armv7k clang: error: linker command failed with exit code 1 (use -v to see invocation)
<我找到了很多解决这个问题的方法,例如将文件添加到编译源。它不起作用。
I found many solutions for this problem like add files to the compile sources for example. It doesn't work.
更新:
此问题在以下情况得到解决您在项目的构建阶段将SDK添加到链接二进制中WatchKit扩展
This problem is solve when you add your SDK to Link Binary in Build Phases of your project WatchKit Extension
新问题:
ld:文件是通用的(4个切片),但不包含(n)armv7k
切片:... clang:错误:链接器命令失败,退出代码为1 (使用
-v来查看调用)
ld: file is universal (4 slices) but does not contain a(n) armv7k slice: ... clang: error: linker command failed with exit code 1 (use -v to see invocation)
我在watchOS上工作。也许SDK不支持watchOS
I work on watchOS. Maybe the SDK doesn't support watchOS
推荐答案
对,它被命名为HueSDK_ iOS .framework for a原因:iOS和watchOS是两种不同的操作系统,有两种不同的架构。
Right, it's named HueSDK_iOS.framework for a reason: iOS and watchOS are two different operating systems, with two different architectures.
相反,要么让你的手表应用程序与你的手机应用程序通话(推荐),要么放弃完全SDK并让您的监视应用发送http / json直接读取和写入桥JSON,使用 NSURLSession
和 NSJSONSerialization
。
Instead, either have your watch app talk to your phone app (recommended), or ditch the SDK completely and have your watch app send http/json to read and write the bridge JSON directly, using NSURLSession
and NSJSONSerialization
.
这篇关于iOS SDK Hue Philips与Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!