-1

We have submitted the app on the app store, and it was approved. But after a day we found out that it is running fine on iOS 5 and 6, but it is crashing on iOS7.

Following is the crash log.

Nov 14 01:45:16 Mys-iPhone AchMyieveCard[4871] <Warning>: Successfully received the test notification!
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Remove User
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Hide the Progress Bar1
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Hide waiting view
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Hide the Progress Bar2
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>:   view did dis appear
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: MainNavController :: setMyToolbar
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Menu Name = My Cards
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: MCPClient :: Method to prepare URL with provided url parameter values
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Key : lastName                      
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Value : Cunningham
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: key lastName, value Cunningham
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Key : ssn4                          
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Value : 2123
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: key ssn4, value 2123
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Key : zipCode                       MyNov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Value : 12345
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: key zipCode, value 12345
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Prepared URL after appending parameters lastName=Cunningham&ssn4=2123&zipCode=12345
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: Hidden  ---  0
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: View Controllers = (
        "<UINavigationController: 0x16557a40>",
        "<UINavigationController: 0x165cd7b0>",
        "<UINavigationController: 0x165d6490>",
        "<UINavigationController: 0x165d89e0>"
    )
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>: View will appear
Nov 14 01:45:16 Mys-iPhone MyApp[4871] <Warning>:  --- >>>>>   hasEnteredInAppFirstTime ::: 1
Nov 14 01:45:16 Mys-iPhone ReportCrash[4877] <Notice>: ReportCrash acting against PID 4871
Nov 14 01:45:16 Mys-iPhone ReportCrash[4877] <Notice>: Formulating crash report for process MyApp[4871]
Nov 14 01:45:16 Mys-iPhone com.apple.launchd[1] (UIKitApplication:com.i2cinc.MyApp[0xbb1c][4871]) <Warning>: (UIKitApplication:com.i2cinc.MyApp[0xbb1c]) Job appears to have crashed: Segmentation fault: 11
Nov 14 01:45:16 Mys-iPhone backboardd[28] <Warning>: Application 'UIKitApplication:com.i2cinc.MyApp[0xbb1c]' exited abnormally with signal 11: Segmentation fault: 11
Nov 14 01:45:16 Mys-iPhone ReportCrash[4877] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyApp_2013-11-14-014516_Mys-iPhone.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
Nov 14 01:45:25 Mys-iPhone mstreamd[4878] <Notice>: (Note ) mstreamd: mstreamd starting up.
Nov 14 01:45:25 Mys-iPhone mstreamd[4878] <Notice>: (Note ) PS: Media stream daemon starting...
Nov 14 01:45:26 Mys-iPhone awdd[4879] <Error>: CoreLocation: CLClient is deprecated. Will be obsolete soon.
Nov 14 01:45:36 Mys-iPhone routined[34] <Notice>: CoreLocation: </System/Library/LocationBundles/Routine.bundle> woken up by Core Location
Nov 14 01:45:36 Mys-iPhone kernel[0] <Debug>: 154088.182708 wlan.A[27556] AppleBCMWLANNetManager::updateLinkQualityMetrics(): Report LQM to User Land 100, fAverageRSSI -69
Nov 14 01:45:36 Mys-iPhone backboardd[28] <Warning>: Launch Services: Registering unknown app identifier /System/Library/LocationBundles/Routine.bundle failed
Nov 14 01:45:36 Mys-iPhone backboardd[28] <Warning>: Launch Services: Unable to find app identifier /System/Library/LocationBundles/Routine.bundle
Nov 14 01:45:36 Mys-iPhone SpringBoard[33] <Warning>: Unknown application display identifier /System/Library/LocationBundles/Routine.bundle.

Code

 NSLog(@"View will appear");
        NSLog(@" --- >>>>>   hasEnteredInAppFirstTime ::: %u", [mClient hasEnteredInAppFirstTime]);
        if([mClient hasEnteredInAppFirstTime]) {
            mClient.hasEnteredInAppFirstTime = NO;

            NSLog(@"Default Screen %@", mClient.defaultScreen);
            if([mClient defaultScreen] == (id)[NSNull null] || [mClient defaultScreen].length == 0 ) {

                NSLog(@"Default screen is nil, going to load dashboard");
                [mClient setUPProgressHUDForView:self.view withLable:@"Generating Dashboard" andMessage:@"Please Wait.."];
                for(UIView *subview in [self.scrollView subviews]) {
                    [subview removeFromSuperview];
                }
                NSLog(@"-->    :::  Going to change here");
                [self generateDashboard];
            } else {
                NSLog(@"Going to push default screen : %@", mClient.defaultScreen);
                //[mClient setUPProgressHUDForView:self.view withLable:@"Loading Default Screen" andMessage:@"Please Wait.."];
                [self pushDefaultScreen:mClient.defaultScreen];
            }
        } 

Kindly help me and let me know what the issue is, why it is crashing and what the solution is.

Dean
  • 939
  • 10
  • 30
Fring
  • 1
  • 3
  • Are these `NSLog`s from production (App store version)? or development? – Popeye Nov 13 '13 at 21:26
  • these are form production app – Fring Nov 13 '13 at 21:28
  • 1
    It's bad practice to have `NSLog`s in production code. Have a read of http://stackoverflow.com/questions/300673/is-it-true-that-one-should-not-use-nslog-on-production-code – Popeye Nov 13 '13 at 21:30
  • If `hasEnteredInAppFirstTime` is `TRUE` you never reach `NSLog(@"Default Screen %@", mClient.defaultScreen);` can tell as this line doesn't get logged out. Are you sure that you even get into this `If statement`. I don't think your issue is in here. – Popeye Nov 13 '13 at 21:32
  • You did not provide the crash log, you did provide the console log. – Kerni Nov 13 '13 at 21:44
  • I have tested same code on local environment where else part of if([mClient hasEnteredInAppFirstTime]) {} gets executed and its working fine there. It only gets crashed when it enters in this IF statement. – Fring Nov 13 '13 at 21:46
  • That isn't a crash log. That is a log of the console. What is the actual crashing backtrace? I.e. the contents of `MyApp_2013-11-14-014516_Mys-iPhone.plist`? – bbum Nov 13 '13 at 23:22

2 Answers2

1

You are mutating an array as you change it:

for(UIView *subview in [self.scrollView subviews]) {
   [subview removeFromSuperview];
}

You should make a copy of the subview array, and send the message to each object in it:

NSArray *oldSubviews = [self.scrollView.subviews copy];
for(UIView *subview in oldSubviews) {
   [subview removeFromSuperview];
}
David H
  • 40,852
  • 12
  • 92
  • 138
0

I was accessing mClient defaultScreen property of another class. and while setting the value in defaultScreen, i was not using this operator with property name. this was working fine in iOS6, but was causing crash in iOS7.

Previous line of code in mClient: defaultScreen = @"screen name";

New code: this.defaultScreen = @"screen name";

now crashed is fixed. :-)

Fring
  • 1
  • 3