分享iphone和apple手表之间的对象数组

时间:2015-10-30 20:25:27

标签: ios objective-c swift watchkit

我想使用WatchKit连接从iPhone发送对象数组到WatchKit扩展。

我尝试使用sendMessageData,但它只接受NSData

如何在iPhone和WatchKit扩展程序之间共享同一个类?

1 个答案:

答案 0 :(得分:1)

You can also use sendMessage(_:replyHandler:errorHandler:) which sends a dictionary of property list values.

To share the same class between iPhone and Watch Extension just add it to both targets:

enter image description here