这里发生的情况是应用程序刚刚接收到了 NSPersistentStoreDidImportUbiquitousContentChangesNotification
通知,我刚刚调用了
- (void)storesDidUpdate:(NSNotification*)note {
FLOG(@"storesDidUpdate ");
[_managedObjectContext mergeChangesFromContextDidSaveNotification:note];
// Refresh user Interface
[[NSNotificationCenter defaultCenter] postNotificationName:@"iProjectCoreDataUpdated"
object:self];
[self updateDetails];
}
现在该应用程序正在尝试通过简单地执行以下操作的方式,使用新的文本副本更新UITextView:
self.detailText.attributedText = [self.detailItem valueForKey:@"scope"];
detailItem是在从iCloud接收更新之前检索的NSManagedObject。
不确定为什么textContainer在抱怨或抱怨什么,也不确定为什么导入日志正在发生,因为我已经收到了完成通知!
奇怪的是,如果我只调用reloadData,其他UITableView会正确更新。
您有任何想法,是否我在这里做错了什么?请注意,如果我不尝试更新textView,则它可以正常工作,如果我关闭视图并返回到它,则会获得正确的数据。
此外,当我重新启动应用程序时,所有数据都在那里,没有损坏或任何问题,事实上,当涉及到Core Data存储时,该应用程序在大多数方面似乎异常稳健,尽管iCloud两侧的事情都会爆炸!
哦,而reloadFetchedResults有点误导,因为我似乎不需要那样做,所以方法名称是过去的遗留物,在此调用中,我只是刷新UI中的值。
2013年10月9日07:25:53.783 MyApp[4509:510b] OpeningViewController.reloadFetchedResults:已调用 2013年10月9日07:25:53.786 MyApp[4509:510b] InfoDetailViewController.reloadFetchedResults:在InfoDetailViewController中已调用 2013年10月9日07:25:53.788 MyApp[4509:510b] * 在/SourceCache/UIFoundation/UIFoundation-258/UIFoundation/TextSystem/NSLayoutManager_Private.m:1510中void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView *, NSTextContainer *, NSUInteger)()中的断言失败 2013年10月9日07:25:53.793 MyApp[4509:510b] -_PFUbiquityRecordImportOperation main:CoreData:Ubiquity:错误导入事务日志: transactionLogLocation::/var/mobile/Library/Mobile Documents/HHHHHHNNNN〜com〜mycompany〜MyApp/CoreData/New Document/duncangroenewald〜simAABC628E-9D5E-58F7-9B8D-0BC724C6D0C8/New Document/W8MckEJ0x2d〜HZZIeUH2be6hs41TEOONzKIrCuLcuP4=/6C953E7C-B2AF-47F7-B828-DD062B96415D.1.cdt transactionNumber:5 ,异常:仅在主线程上运行! 用户信息:(null) 2013年10月9日07:25:53.803 MyApp[4509:510b] -_PFUbiquityRecordsImporter操作:failedWithError :: CoreData:Ubiquity:导入操作遇到错误:Error Domain = NSCocoaErrorDomain Code = 134060“无法完成操作。 (Cocoa错误134060。)”UserInfo = 0x16d882c0 {exception = Only run on the main thread!} userInfo:{ exception =“仅在主线程上运行!”; }。 尝试导入URL处的日志文件: transactionLogLocation::/var/mobile/Library/Mobile Documents/HHHHHHNNNN〜com〜mycompany〜MyApp/CoreData/New Document/duncangroenewald〜simAABC628E-9D5E-58F7-9B8D-0BC724C6D0C8/New Document/W8MckEJ0x2d〜HZZIeUH2be6hs41TEOONzKIrCuLcuP4=/6C953E7C-B2AF-47F7-B828-DD062B96415D.1.cdt transactionNumber:5 2013年10月9日07:25:53.809 MyApp[4509:510b] *由于未捕获的异常'NSInternalInconsistencyException',原因:'仅在主线程上运行!' ***第一个抛出调用堆栈: (0x2ff23f53 0x3a6996af 0x2ff23e2d 0x308cb1df 0x3796643d 0x37966185 0x3798f7bb 0x379926f7 0x37992759 0x379b378b 0x379b331f 0x379b2f0d 0x3273b05d 0x129717 0x2fee6121 0x2fe5a317 0x3083edcd 0x308436ab 0x118263 0x2fee6121 0x2fe5a317 0x2fd8c69f 0x2fd8cc93 0x2fd813dd 0x3085197b 0x308f5b35 0x3ab83297 0x3ab8309b 0x3ab83d15 0x3ab83f8d 0x3acbedbf 0x3acbec84) libc ++ abi.dylib:以NSException类型终止未捕获的异常编辑: 我在这里发布了一些iOS和OSX的Core Data/iCloud应用程序示例 - 它们包括用于加载/删除数据的后台线程以及iCloud同步。希望解决此处描述的问题。http://ossh.com.au/design-and-technology/software-development/sample-library-style-ios-core-data-app-with-icloud-integration/