2016-04-27 69 views
0

我發佈了iOS應用的更新,AFAIK並未改變我們處理推送通知的方式。PFAddUniqueOperation - 部分用戶的系統崩潰

但是,我們的用戶的一個子集報告系統在啓動時崩潰。 佈告訴我的應用程序崩潰是由於:

Fatal Exception: NSInternalInconsistencyException 
Operation is invalid after previous operation. 

,並顯示在我suscribe用戶中的默認方法updateAgenciesChannels推渠道,它的存在的:

NSArray *agencies = [NSArray arrayWithObjects:@"channelA",@"channelB", nil]; 
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 

for(NSString *agency in agencies) 
{ 
    NSString *agencyString = [@"a-" stringByAppendingString:agency]; 
    BOOL agencyState = [defaults boolForKey:agencyString]; 
    if(agencyState) 
     [currentInstallation addUniqueObject:agencyString 
             forKey:@"channels"]; 
    else 
     [currentInstallation removeObject:agencyString 
             forKey:@"channels"]; 

    [currentInstallation saveInBackground]; 
} 
  • 這並不似乎是與iOS版本相關(所有崩潰都發生在9.1.3上,但很多9.1.3上的用戶都非常好),似乎也與設備類型無關。

  • 對於用戶的這個子集,飛機墜毀系統,對所有發佈,甚至刪除/安裝應用程序後之後再次

以下是完整的崩潰日誌之一:

Fatal Exception: NSInternalInconsistencyException 
0 CoreFoundation     0x180ffee38 __exceptionPreprocess 
1 libobjc.A.dylib    0x180663f80 objc_exception_throw 
2 CoreFoundation     0x180ffed80 -[NSException initWithCoder:] 
3 NextRide      0x1001c012c -[PFAddUniqueOperation mergeWithPrevious:] (PFFieldOperation.m:277) 
4 NextRide      0x1001e1240 -[PFObject(Private) performOperation:forKey:] (PFObject.m:1172) 
5 NextRide      0x1001e83dc -[PFObject addUniqueObjectsFromArray:forKey:] (PFObject.m:2170) 
6 NextRide      0x1001e8318 -[PFObject addUniqueObject:forKey:] (PFObject.m:2166) 
7 NextRide      0x1000ac4c8 +[NRNPush updateAgenciesChannels] (NRNPush.m:54) 
8 NextRide      0x1000ac2dc +[NRNPush updateDefaultChannels] (NRNPush.m:35) 
9 NextRide      0x100083b10 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:86) 
10 UIKit       0x1861be8a8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] 
11 UIKit       0x1863ee094 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] 
12 UIKit       0x1863f2500 -[UIApplication _runWithMainScene:transitionContext:completion:] 
13 UIKit       0x1863ef674 -[UIApplication workspaceDidEndTransaction:] 
14 FrontBoardServices    0x18299f7ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ 
15 FrontBoardServices    0x18299f618 -[FBSSerialQueue _performNext] 
16 FrontBoardServices    0x18299f9c8 -[FBSSerialQueue _performNextFromRunLoopSource] 
17 CoreFoundation     0x180fb5124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 
18 CoreFoundation     0x180fb4bb8 __CFRunLoopDoSources0 
19 CoreFoundation     0x180fb28b8 __CFRunLoopRun 
20 CoreFoundation     0x180edcd10 CFRunLoopRunSpecific 
21 UIKit       0x1861b7834 -[UIApplication _run] 
22 UIKit       0x1861b1f70 UIApplicationMain 
23 NextRide      0x1000d054c main (main.m:28) 
24 libdispatch.dylib    0x180a7a8b8 (Missing) 

回答

0

事實證明,我試圖在多次調用此方法時嘗試將用戶訂閱到頻道,如果他已經訂閱(Array中已有「唯一對象」),並嘗試將用戶取消寫入頻道if他已經沒有認同(刪除對象不是我n陣列)