登录Facebook时,应用程序崩溃了。 打开它第一次工作正常,但一旦你登录Facebook 它崩溃了。授权成功但随后崩溃并引发以下异常:
2016-01-26 03:20:35.909 VIT Foody[43064:1911291] {
id = 10204157645941939;
name = "Supreet Singh";
}
2016-01-26 03:20:35.914 VIT Foody[43064:1911291] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArray removeObjectAtIndex:]: mutating method sent to immutable object'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ecd2885 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e74bdf1 objc_exception_throw + 48
2 CoreFoundation 0x000000010ecd27bd +[NSException raise:format:] + 205
3 CoreFoundation 0x000000010eccb06e -[__NSCFArray removeObjectAtIndex:] + 94
4 VIT Foody 0x000000010e03a90f -[TrendingController choose] + 719
5 VIT Foody 0x000000010e039f31 -[TrendingController viewDidLoad] + 1361
6 UIKit 0x000000010f41bd65 -[UIViewController loadViewIfRequired] + 860
7 UIKit 0x000000010f41c0b4 -[UIViewController view] + 27
8 UIKit 0x000000010f47870d -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 502
9 UIKit 0x000000010f477a67 -[UITabBarController transitionFromViewController:toViewController:] + 59
10 UIKit 0x000000010f473810 -[UITabBarController _setSelectedViewController:] + 377
11 UIKit 0x000000010f473686 -[UITabBarController setSelectedViewController:] + 234
12 UIKit 0x000000010f33aa1c +[UIView(Animation) performWithoutAnimation:] + 65
13 UIKit 0x000000010f46f727 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 344
14 UIKit 0x000000010f470711 -[UITabBarController viewWillAppear:] + 195
15 UIKit 0x000000010f4215cc -[UIViewController _setViewAppearState:isAnimating:] + 710
16 UIKit 0x000000010f421c6e -[UIViewController __viewWillAppear:] + 149
17 UIKit 0x000000010f45cc24 -[UINavigationController _startTransition:fromViewController:toViewController:] + 767
18 UIKit 0x000000010f45dbc8 -[UINavigationController _startDeferredTransitionIfNeeded:] + 890
19 UIKit 0x000000010f45eac4 -[UINavigationController __viewWillLayoutSubviews] + 57
20 UIKit 0x000000010f5e9e2c -[UILayoutContainerView layoutSubviews] + 248
21 UIKit 0x000000010f344d44 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 662
22 QuartzCore 0x0000000112fe7c80 -[CALayer layoutSublayers] + 146
23 QuartzCore 0x0000000112fdc6ae _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
24 QuartzCore 0x0000000112fdc52c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
25 QuartzCore 0x0000000112fd1104 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
26 QuartzCore 0x0000000112ffdf6c _ZN2CA11Transaction6commitEv + 508
27 UIKit 0x000000010f2c2676 _afterCACommitHandler + 174
28 CoreFoundation 0x000000010ebfca27 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
29 CoreFoundation 0x000000010ebfc997 __CFRunLoopDoObservers + 391
30 CoreFoundation 0x000000010ebf247b __CFRunLoopRun + 1147
31 CoreFoundation 0x000000010ebf1d78 CFRunLoopRunSpecific + 488
32 GraphicsServices 0x0000000110eb7bca GraphicsServices + 52170
33 UIKit 0x000000010f29a79b UIApplicationMain + 171
34 VIT Foody 0x000000010e02621f main + 111
35 libdyld.dylib 0x00000001150a1a05 libdyld.dylib + 10757
36 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
趋势视图控制器如下: 视图确实加载方法我猜是
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.tintColor=[UIColor whiteColor];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Loading..."];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
[self.mCollectionView addSubview:refreshControl];
NSDictionary *username;
save=@"trend";
if([[NSUserDefaults standardUserDefaults] objectForKey:@"username"])
{
username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSLog(@"%@",[username description]);
name.hidden=NO;
name.text=[username valueForKey:@"first_name"];
}
array = [[NSMutableArray alloc]init];
arrayB = [[NSMutableArray alloc]init];
[self.mCollectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
if([[NSUserDefaults standardUserDefaults] objectForKey:save])
{
x=0;
array=[[NSUserDefaults standardUserDefaults] objectForKey:save];
[self choose];
}
request = [[NSMutableURLRequest alloc]init];
sta=[NSString stringWithFormat:@"http://vitcreativityclub.com/api/RESTAURANTAPI.php"];
[request setURL:[NSURL URLWithString:sta]];
[self requesting:request];
// Do any additional setup after loading the view.