2016-04-27 49 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阵列)