我目前使用谷歌分析(V2.0)的iOS GoogleAnalytic连续生产
的最后一个版本例外,我实例在我的appDelegate最常见的方式:
但是,当我“M在运行程序的时候,在日志中不断产生这种异常:
An observer of NSManagedObjectContextDidSaveNotification illegally threw an exception. Objects saved = {
deleted = "{(\n <GAIHit: 0xc1cac50> (entity: GAIHit; id: 0xc160740 <x-coredata://8854889C-BE6C-49BB-BBA9-99465B86265E/GAIHit/p26> ; data: {\n dispatchUrl = \"https://ssl.google-analytics.com/collect\";\n gaiVersion = \"2.0b4\";\n parametersData = <62706c69 73743030 d4010203 04050852 53542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976 6572>;\n timestamp = \"2013-07-10 10:21:55 +0000\";\n})\n)}";
inserted = "{(\n)}";
updated = "{(\n)}";
} and exception = Object's persistent store is not reachable from this NSManagedObjectContext's coordinator with userInfo = (null)
它不会使应用程序崩溃,但它是非常冗长,污染我的日志。
而且,它似乎工作,因为GA日志说:
-[GAIDispatcher dispatchComplete:withStartTime:withRetryNumber:withResponse:withData:withError:] (GAIDispatcher.m:415) DEBUG: Successfully dispatched hit /GAIHit/p51 (0 retries).
任何想法,以制止这些日志?
在你的情况下改变处理程序(您注册'contextChanged:通知)你可以检查通知是否来自你的核心数据会话或不是这样的:if(((NSManagedObjectContext *)notification.object).persistentStoreCoordinator!= self.persistentStoreCoordinator)return;' – gklka