- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在将数据从 iOS 传递到 WatchKit。 但我无法获得显示在 WatchKit 端收到的数据。
这很好用:iOS TableViewController
func getCloudKit() {
///...
let publicData = container.publicCloudDatabase
publicData.performQuery(query, inZoneWithID: nil) { results, error in
if error == nil { // There is no error
for play in results! {
let newPlay = Play()
newPlay.tColor = play["TColor"] as! String
do {
try WatchSessionManager.sharedManager.updateApplicationContext(["color" : newPlay.tColor])
NSLog("NewPColor: %@", newPlay.tColor)
} catch {
print(error)
}
self.objects.append(newPlay)
}
} else {
print(error)
}
}
}
这不是调用任何 NSLog
或显示任何数据:WatchKit InterfaceController
import WatchConnectivity
class InterfaceController: WKInterfaceController, WCSessionDelegate {
@IBOutlet var colorLabel: WKInterfaceLabel!
private let session: WCSession? = WCSession.isSupported() ? WCSession.defaultSession() : nil
private func configureWCSession() {
session?.delegate = self;
session?.activateSession()
}
override init() {
super.init()
configureWCSession()
}
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
}
func session(session: WCSession, didReceiveApplicationContext applicationContext: [String : AnyObject]) {
let colorWatch = applicationContext["color"] as? String
NSLog("Check if anything here: %@", colorWatch!)
dispatch_async(dispatch_get_main_queue()) {
if let colorWatch = colorWatch {
self.colorLabel.setText("From iPhone: \(colorWatch)")
NSLog("Heres all the strings %@", colorWatch)
} else {
NSLog("Nothing")
}
}
}
}
有什么想法吗?谢谢!
最佳答案
尝试检查 session 是否为零(我的 swift foo 很弱):
private func configureWCSession() {
print("session: \(session?))
session?.delegate = self;
session?.activateSession()
}
关于ios - WatchKit 数据不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32801818/
我正在尝试创建一个 iOS WatchOS5 复杂功能,并且看到了许多教程和苹果文档。他们谈论: WatchKit 应用 WatchKit 应用扩展 iOS WatchKit 应用程序和 WatchK
我正在 Storyboard 中设置一个菜单和菜单项,并且希望一个菜单项在两种状态之间切换,例如开/关、摄氏度/华氏度等 但是,从菜单项按住控制拖动到界面 Controller 并不能让我创建导出,而
我必须将数据从我的 watchkit 发送到另一个 watchkit。可能吗 ?如果是,那么实现它的方法是什么? 我知道如何通过 [WKInterfaceController openParentAp
我在编译 watchkit 应用程序时遇到此错误 嵌入式二进制验证实用程序错误 error: WatchKit Extension contains multiple WatchKit apps wh
我们有一个分层的 watch 应用程序。 根 Controller 是一个菜单项表。该项目列表由服务器控制。数据被检索并存储在核心数据中。第一次进入应用程序时会填充菜单。 但我希望这张表保持最新。我的
我的应用程序显示各种倒数计时器,用户将查看这些计时器以了解何时执行各种任务。当应用程序位于前台时,我希望此屏幕继续显示在 watch 上。目前,屏幕会自动关闭,如果我不甩手腕,应用程序甚至会暂停。 这
谁能帮我编写一份示例代码,以便在 Apple Watchkit 应用中添加语音到文本转换功能。 最佳答案 是的,这是可能的。这是文档: https://developer.apple.com/libr
关于这个问题有几篇文章,但没有一个建议的解决方案适用于我的情况。我正在尝试按照 Apple 提供的说明将 WatchKit 集成到一个简单的示例应用程序中(我现在已经尝试了几个)。编译时出现以下错误消
昨天我saw this post并让我意识到我有问题。 在商店中有 WatchOS1 应用程序后,我创建了一个 WatchOS2 应用程序。当我尝试运行该应用程序时 made me upgrade m
iOS可以使用layer.cornerRadius打个圆UIButton . 是否WKInterfaceButton有这个属性吗? 如果没有,我怎么才能圆WKInterfaceButton在 Watc
错误信息: This app contains multiple WatchKit 2.0 apps. Only a single WatchKit 2.0 app is allowed. Watch
好吧,这是非常基本的,但我已经一遍又一遍地阅读了文档,并想确保我做对了。用通俗易懂的语言来说,我的 watchkit 应用程序将因退出我的代码外部应用程序的某些用户交互而关闭,对吗?我不需要使用任何类
在具有 WatchKit 扩展和 WatchKit 应用程序 - 目标的 xcode 项目中。如果我重命名目标 - 从例如:“Sample WatchKit App”和“Sample WatchKit
如果我将界面 Storyboard 的自定义类放在 WatchKit 或 WatchKist 扩展中,会有什么不同。 (以 myInterfaceController 为例) 最佳答案 您的 Watc
我有一个支持 Watchkit 的应用程序。当我在 iPhone 上运行该应用程序时,它构建良好,但在 Xcode 中显示警告“WatchKit 应用程序具有无效的 stub 可执行文件”。我已正确使
我在 WKExtensionDelegate 和 WKInterfaceController 上都添加了日志。 这是我在玩启动和退出应用程序时得到的结果 观看操作系统模拟器。 (模拟器运行 watch
验证 WatchKit 应用的 Info.plist 中 WKWatchKitApp 的值是否设置为 YES。 最佳答案 经过数周又数周的调查,我终于发现了问题所在。 Iphone App的产品名称与
我今天尝试将我的应用程序加载到 iTunesConnect,但在重新构建期间出现错误。没有找到配置文件(当我只为我的 iPhone 应用程序运行它时,它工作得很好并且已经有一段时间了)。所以我认为这是
我正在尝试将我的 Apple Watch 应用上传到 iTunes,每次我上传我的二进制文件时,我都会收到来自苹果团队的以下邮件。我已经完成了我的以下 list 。 为 watchapp 和扩展程序创
好的。在经典 iOS 中做到这一点很容易,但 WatchKit 不提供任何 block /闭包,并且在带/不带动画之间没有选择。 我有一个根 Controller ,其中有一个选项列表。触摸其中一个选
我是一名优秀的程序员,十分优秀!