当我收到有关记录添加的远程通知(didReceiveRemoteNotification被调用)时,我收到以下错误消息:
_BSMachError:(os/kern)无效功能(20)
我已经尝试在论坛和谷歌中找到更多相关信息,但我找不到适合我情况的任何有用的建议.
错误消息是什么意思?我能做些什么呢?
如何在Apple手表上显示Alert.是否有任何替代方案可以在Apple Watch中显示警报,因为我检查过并且UIAlertView无法在Apple Watch上运行.
情况:我openParentApplication
在Watch应用程序handleWatchKitExtensionRequest
中使用主应用程序.这在模拟器中运行良好,当iPhone应用程序处于活动/打开状态时,它也适用于实际设备(Apple Watch和iPhone).
问题:当我在实际设备(Apple Watch和iPhone)上运行它时,如果主iPhone应用程序未处于活动/打开状态,handleWatchKitExtensionRequest
则不会返回数据openParentApplication
.
WatchKit扩展中的InterfaceController.m中的代码:
NSDictionary *requst = @{ @"request" : @"getData" };
[InterfaceController openParentApplication:requst
reply:^( NSDictionary *replyInfo, NSError *error ) {
// do something with the returned info
}];
Run Code Online (Sandbox Code Playgroud)
iPhone主应用程序的app代理中的代码:
- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void ( ^)( NSDictionary * ))reply
{
if ( [[userInfo objectForKey:@"request"] isEqualToString:@"getData"] )
{
// get data
// ...
reply( data );
}
}
Run Code Online (Sandbox Code Playgroud) 当我运行下面的代码时,返回的方法rowControllerAtIndex
为WKInterfaceTable
nil.
[self.outletTable setNumberOfRows:numberOfCategoriesToShow withRowType:@"rowTypeLabel"];
RowControllerTypeLabel *theRow = [self.outletTable rowControllerAtIndex:rowInTable];
Run Code Online (Sandbox Code Playgroud)
我检查了什么:
RowControllerTypeLabel
.Custom Class
标签的字段设置为我的自定义类RowControllerTypeLabel
.我错过了什么?
以下代码适用于没有最后一个语句.但是,在最后一行,Xcode停止并显示以下消息:
CoreData` + [NSManagedObjectContext Multithreading_Violation_AllThatIsLeftToUsIsHonor ]:
NSManagedObjectContext *context = GLOBAL_appDelegate.coreDataHelper.contextBackground;
[context performBlock:^{
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"CdTag" inManagedObjectContext:context]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"title BEGINSWITH[cd] %@", @"webpages"];
[fetchRequest setPredicate:predicate];
NSArray *cdTags = [context executeFetchRequest:fetchRequest error:nil];
NSLog(@"number of tags: %li", cdTags.count);
CdTag *cdTag = [cdTags objectAtIndex:0];
// Accessing a property causes the assertion warning to be shown
cdTag.title;
}];
Run Code Online (Sandbox Code Playgroud)
我正在使用Xcode 7 beta 5,我启用了多线程断言.
上下文定义如下:
_model = [NSManagedObjectModel mergedModelFromBundles:nil];
_coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:_model];
_context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; …
Run Code Online (Sandbox Code Playgroud) 在开发应用程序时,强制退出应用程序而不必重新启动整个设备有时很有用.
在我的iPhone上,我可以通过双击主页按钮并将应用程序刷到顶部来强制退出活动应用程序.
对于实际的Apple Watch(不是模拟器),强制退出应用程序特别有用,因为Xcode和手表应用程序之间有时会出现连接问题.此外,有时我想在未连接到Xcode时强行退出Apple Watch应用程序.
那么,如何在不重启整个设备的情况下强制退出/终止Apple Watch上的活动应用程序?
当我尝试在我真正的Apple Watch上构建并运行WatchKit扩展时,我有时会收到以下错误消息:
我已经尝试为iPhone构建父应用程序,然后再为我的WatchKit应用程序构建,但我仍然收到错误消息.
有谁知道是什么原因导致此错误消息以及如何处理它?
我正在寻找一种方法来存储Apple Watch应用程序上的一些东西,我稍后可以阅读,这使我能够识别它.
我目前没有看到任何API可以让我这样做.我最接近的是将图像保存在缓存中,但由于它只是缓存,因此不可靠.
我的目标是唯一识别Apple Watch.
任何指针都将非常感激.
我已经为我的应用程序创建了 WatchKit 扩展。两者共享一个通用的应用程序组容器来存储和获取数据文件。
我的应用程序及其扩展程序之间共享的应用程序组容器的最大存储限制是多少?
我用来FileManager.default.contentsOfDirectory
获取 iCloud Drive 目录的内容。但是,有时,当我在 Mac 上删除文件时,内容不是最新的。我可以通过打开 iPhone 上的“文件”应用程序并浏览到该目录来强制同步。之后,更改在我的 iOS 应用程序中也可见。
我的问题:如何手动和以编程方式强制在我的 iOS 设备 (iPhone) 和 iCloud 之间同步 iCloud Drive?
ios ×8
watchkit ×5
apple-watch ×4
objective-c ×4
cloudkit ×1
core-data ×1
icloud-drive ×1
quit ×1
watchos-2 ×1
xcode ×1