因此,在watchOS 3.0中,您现在可以获得数字表冠的旋转.我设法在InterfaceController中使用crown IDRotate函数.但是我无法从SKScene Class中获得表冠的旋转.任何人都可以帮我这个我现在很迷茫吗?谢谢.
自从在Xcode 8(Beta 1)和Swift 3上升级后,我在此行中出错:
class CloudViewController: UIViewController, WCSessionDelegate {
Run Code Online (Sandbox Code Playgroud)
它说 :
类型'UIViewController'不符合协议'WCSessionDelegate'
这是我的(使用Xcode 7和Swift 2)代码:
override func viewDidLoad() {
super.viewDidLoad()
if(WCSession.isSupported()){
self.session = WCSession.default()
self.session.delegate = self
self.session.activate()
}
}
func session(_ session: WCSession, didReceiveMessage message: [String : AnyObject]) {
print("didReceiveMessage")
watchMessageHandler.getMessage(message)
}
Run Code Online (Sandbox Code Playgroud)
此错误也会显示在WKInterfaceController类中.
我已经读过,我们现在可以在watchos 3中的苹果手表上播放自定义声音.
根据苹果的声明显然有,但我没有一个例子来测试它:使用SCNAudioSource或SCNAudioPlayer实现的3D空间音频.相反,使用playAudioSource:waitForCompletion:或WatchKit声音或触觉API.在此处找到:https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInwatchOS/Articles/watchOS3.html
有人可以举一个简单的例子.我没有在我的应用程序中使用SceneKit,因为我不需要它,但如果这是播放自定义声音的唯一方法,那么我想知道完成此操作所需的最少代码.最好是在目标c中,但我会把它带到任何形状.如果这也更容易,我可以使用SpriteKit.
这是我到目前为止所做的,但它不起作用:
SCNNode * audioNode = [[SCNNode alloc] init];
SCNAudioSource * audioSource = [SCNAudioSource audioSourceNamed:@"mysound.mp3"];
SCNAudioPlayer * audioPlayer = [SCNAudioPlayer audioPlayerWithSource:audioSource];
[audioNode addAudioPlayer:audioPlayer];
SCNAction * play = [SCNAction playAudioSource:audioSource waitForCompletion:YES];
[audioNode runAction:play];
Run Code Online (Sandbox Code Playgroud) 在我的项目中,我想在我的iOS 10应用程序和我的watchOs 3应用程序中同时使用一个Realm数据库.所以我所做的是将框架添加到三个不同目标的嵌入式二进制文件中.这恰好工作得很好但是watchKit扩展似乎不能识别我在iOS环境中创建的对象.如何在这两个设备之间建立共享的Realm数据库?
我需要从我的父iOS应用程序打开我的手表扩展程序.我在Nike + Run Club应用程序中看到了类似的功能.即,当用户点击父应用程序中的开始按钮时,将立即打开监视工具包扩展.
我正在尝试在 watchos3.1 上开发我的应用程序,每次出现此错误时我都会收到。
no symbols for paired Apple watch
Run Code Online (Sandbox Code Playgroud)
Xcode 不会为我的 watchOS 3.1 下载最新的符号。在我的折叠
Library->Developer->Xcode->watchOS DeviceSupport->
Run Code Online (Sandbox Code Playgroud)
我只找到一个带有“watch1,2 3.0”的文件
我如何用 3.1 下载文件?
我正在尝试让 iCloud 在 iPhone 和 Apple Watch 之间工作(在 watchOS 3 上使用 CloudKit)。我已将 Watch Extension 中的云容器指定为与 iOS 目标中的云容器相同,但是在运行该应用程序时,我从我所做的查询中收到此错误:
Failure retrieving: Optional(<CKError 0x17d45cf0: "Unknown Item" (11/2003); server message = "did not find record type recordTypeId="Recommendation""; uuid = 37D53C78-FF19-4CE3-80BD-C1990F0135A2; container ID = "iCloud.mathsrobot.MathsRobot-LearnMaths.watchkitapp.watchkitextension">)
Run Code Online (Sandbox Code Playgroud)
从容器 ID,我可以看出它没有使用 iOS 应用程序容器,应该是iCloud.mathsrobot.MathsRobot-LearnMaths. 如何让它为 iOS 应用程序使用 iCloud 容器?
iOS 目标能力截图 iCloud 的主要 iOS 目标能力
观看目标功能截图 使用 iCloud 观看扩展目标功能
我想为手表应用设计模块化的大型复杂功能。在我的复杂视图中,我希望用户同时使用图像和文本。
我有一些与设计相关的问题,如下所示:
我已经检查了模块大型复杂苹果文档,但我没有得到足够的信息。Apple Doc:- 模块化大型复杂功能
swift apple-watch watchkit apple-watch-complication watchos-3
我正在构建iOS + watchOS应用,这些应用需要在iOS和watch应用状态的所有可能组合中通知用户更新的信息:当iOS和watchOS都在前台运行时,当它们都在后台运行时,当一个或另一个在后台时。
我已经成功处理了这四种情况中的三种的推送通知。卡住的地方是手表应用在前台打开而iOS应用在后台-我找不到手表通知控制器,其ExtensionDelegate或在以下情况下会触发的iOS AppDelegate的任何方法:在这种情况下,将推送远程通知。
在iOS AppDelegate中,当iOS应用程序处于前台状态且观看应用程序处于任一状态时,在推送通知时将触发:
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
Run Code Online (Sandbox Code Playgroud)
在WatchKit Extension NotificationController中,当iOS和watch应用都在后台时推送通知时将触发此事件:
override func didReceive(_ notification: UNNotification, withCompletion completionHandler: @escaping (WKUserNotificationInterfaceType) -> Swift.Void) { ... }
Run Code Online (Sandbox Code Playgroud)
但是,如果在推送通知时手表应用程序位于前台,而iOS应用程序位于后台,则通知横幅会出现在iPhone上(即使屏幕锁定),但我发现没有办法处理和更新除非当时手表也在后台。
有任何想法吗?
我正在尝试制作一个watchOS 3应用程序,我想在后台任务中更新我的复杂功能.
首先,我从后台任务中的服务器获取新数据handle().在那之后,我通过电话更新我的主动并发症complicationServer.reloadTimeline(for:).
在控制台中,我看到消息"更新复制",因此代码被执行.
然而,重新加载后,并发症仍显示旧数据.如果我切换表盘并切换回来,那么复杂功能有时会重新加载.我是否必须做其他事情才能从后台任务重新加载复杂功能?
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
for task : WKRefreshBackgroundTask in backgroundTasks {
if (WKExtension.shared().applicationState == .background) {
if task is WKApplicationRefreshBackgroundTask {
let dataProvider = DataProvider()
dataProvider.getData(station: "Name", completion: { (data, error) in
self.updateComplication()
self.scheduleNextBackgroundRefresh()
task.setTaskCompleted()
})
}
} else {
task.setTaskCompleted()
}
}
}
func updateComplication() {
let complicationServer = CLKComplicationServer.sharedInstance()
for complication in complicationServer.activeComplications! {
print("UPDATE COMPLICATION")
complicationServer.reloadTimeline(for: complication)
}
}
Run Code Online (Sandbox Code Playgroud) watchkit clockkit apple-watch-complication watchos-3 wkrefreshbackgroundtask