iOS SDK Hue Philips with Swift

我是研究僧i 提交于 2019-12-06 07:31:25

问题


I tried to import iOS SDK in Objective C for Hue.

I followed instructions here : https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX

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()

I have this errors :

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.

UPDATE :

This problem is solve when you add your SDK to Link Binary in Build Phases of your project WatchKit Extension

New problem :

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)

I work on watchOS. Maybe the SDK doesn't support watchOS


回答1:


Right, it's named HueSDK_iOS.framework for a reason: iOS and watchOS are two different operating systems, with two different architectures.

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.



来源:https://stackoverflow.com/questions/38529055/ios-sdk-hue-philips-with-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!