Tag: 苹果手表

WatchKit在handleWatchKitExtensionRequest块中返回reply():

我看到这个 SOpost显然是数据被提取并返回到Watch扩展,如下所示: – (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void ( ^)( NSDictionary * ))reply { if ( [[userInfo objectForKey:@"request"] isEqualToString:@"getData"] ) { // get data // … reply( data ); } } 但是当我尝试在获取networking数据之后调用“reply()”内部块时, __block UIBackgroundTaskIdentifier watchKitHandler; watchKitHandler = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"backgroundTask" expirationHandler:^{ watchKitHandler = UIBackgroundTaskInvalid; }]; – (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void ( ^)( NSDictionary * […]

无法find接口控制器类“InterfaceController”来实例化

每次运行项目时都会收到此错误,并尝试导航到另一个屏幕。 Unable to find interface controller class 'HelpInterfaceController' to instantiate 我使用正确的,我知道: – (IBAction)HelpButton { [self presentControllerWithName:@"help" context:nil]; } 此外,名称help与标识符中的一样。 那么我要去哪里或哪里出错?

当用户停止说话时,如何停止Apple Watch中的语音识别(听写)?

我已经成功地在Apple Watch(WatchOS 2.1,iOS 9.2.1)中实现了原生语音识别(Dictation),基本上我使用了这个代码,并有一个空的“菜单选项数组”: func launchDictation(){ self.presentTextInputControllerWithSuggestions([], allowedInputMode: WKTextInputMode.Plain, completion:{ (results) -> Void in let aResult = results?[0] as? String if(!(aResult == nil)){ print(aResult) print("SHORT ASR COMPLETED") dispatch_async(dispatch_get_main_queue()) { // Update UI } }//end if })//end show voice menu } 因为它是…用户点击一个“说话button”,然后popup一个视图(显示检测到的话作为用户说话和一个不错的小容量图)。 现在,用户必须说话,然后点击“完成”来完成语音识别。 如果检测到短语但未点击“完成”,则“听写失败”最终将出现在屏幕上。 是否有人知道如何实现一些侦听器或委托,以便在用户停止讲话几秒后检测到听写过程的结束时间?

在Apple Watchkit中播放声音

我试图通过使用WKAudioFilePlayer的watchkit扩展播放声音,但没有声音播放。 我使用触觉反馈代码作为一种debugging,以确保它执行(它)。 作为一个侧面说明,静音没有打开,文件名是正确的。 NSURL *falcon = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"falcon" ofType:@"mp3"]]; WKAudioFileAsset *asset = [WKAudioFileAsset assetWithURL:falcon]; WKAudioFilePlayerItem *sound = [WKAudioFilePlayerItem playerItemWithAsset:asset]; audioPlayer = [WKAudioFilePlayer playerWithPlayerItem:sound]; [audioPlayer play]; WKInterfaceDevice *device = [WKInterfaceDevice currentDevice]; [device playHaptic:WKHapticTypeClick];

如何获得苹果手表唯一的ID或UDID?

我想获得Apple Watch独特的ID。 有什么可用的像UDID或开发人员的唯一标识符?

Apple Watch中的手势识别(WatchKit)

我正在寻找如何通过WatchKit SDK在Apple Watch应用程序中检测手势。 在iOS中,我们可以使用这样的代码: – (void)viewDidLoad { … UISwipeGestureRecognizer *swipeRightBlack = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(slideToRightWithGestureRecognizer:)]; swipeRightBlack.direction = UISwipeGestureRecognizerDirectionRight; [self.viewBlack addGestureRecognizer:swipeRightBlack]; } …但是这在Apple Watch模拟器中不起作用。 有没有办法来覆盖使用WatchKit的默认手势操作,或者只是当操作系统接收到它们时识别它们?

开发者在Apple Watch上使用“Taptic Engine”

根据苹果有关iOS 8.2和Xcode 6.2的发布信息,他们提到开发者可以使用苹果手表提供的新技术: 借助iOS 8.2 beta SDK,开发人员现在可以开始使用WatchKit创build突破性的新应用程序,概览和可操作的通知,这些通知专为创新的Apple Watch界面devise,并与Force Touch,Digital Crown和Taptic Engine等新技术配合使用 。 在梳理WatchKit框架文档后,我没有发现使用Taptic引擎。 有开发人员使用它的方法吗? 也许他们还没有实现,可能会在iOS 8.2以后的更新,但我不认为这是事实。 我错过了什么?

无法在WatchKit中设置自定义字体

我正在设置Roboto字体,并添加了作为watch kit扩展的目标,但它仍然是零。 我们可以在手表套件中设置自定义字体吗?

NSUserDefault在watchppExtension中更改通知处理

我正在创build一个iwatch应用程序,只需在iphone应用程序中单击tableview时显示值。 我想获得共享userdefault值更改通知。 它是watchkitapp和iPhone应用程序之间共享,所以当用户做任何改变的手机我必须得到通知。 我做了以下 当用户在手机上执行某些操作时 NSUserDefaults *shared = [[NSUserDefaults alloc] initWithSuiteName:@"group.app"];</br> id object = [self.plantsArray objectAtIndex:[self.plantsTable indexPathForSelectedRow].row];</br> [shared setObject:object forKey:@"data"];</br> [shared synchronize]; 在watchkit扩展中已经注册了通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(print) name:NSUserDefaultsDidChangeNotification object:nil]; 但不幸的是,我没有收到任何通知,任何人都知道一些解决scheme

如何在Apple Watch中将modal segue的标签“取消”更改

当我打开一个模式视图时,如何改变出现在左上angular的标签“取消”…我希望它是一个带有图像的button。