我目前使用谷歌分析(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