PLCrashReporter doesnt open when the app crashes - ios

first time user of PLCrashReporter. I have written the code in my appDelegate.m file
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
NSLog(#"inside applicationdidfinishlaunching to do crash reporting");
PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
NSError *error;
if ([crashReporter hasPendingCrashReport])
[self handleCrashReport];
if (![crashReporter enableCrashReporterAndReturnError:&error])
NSLog(#"Warning: Could not enable crash reporter %#",error);
}
I wrote handleCrashReport as it is in the example. I also on purpose crashed my app on clicking a button.(NSRangeException index 0 beyond bounds for empty array) like this:
NSMutableArray *mtestArray = [NSMutableArray new];
NSLog(#"%#",[mtestArray objectAtIndex:0]);
It throws exception (i.e. goes to main.m file. Doesn't go to home screen. It stays on the main.m file). I stop the execution and restart the app and it goes to a screen (this screen occurs if it were correct actually). I dont see a pop up saying send crash report or don't. I added CrashReporter.framework and libcrashreporter-iphonesimulator.a to my project. I changed mach-o and perfom single...as told in the article. I have been at this for more than 2 hours. Why dont i see the error dialog?
I put breakpoints at my applicationdidfinishlaunching and they NEVER get hit. I deleted my app and reinstalled (re-run) and still no go. Also my project is an iPad project with iOS 6.1. I read that crash report dialog appears on second time start of the app. But it won't any time,2nd or 3rd. If you need more information, please ask. Thanks
EDIT : Does plcrash reporter work for iPads also? I took the help from this blogpost
http://mandeepdhiman.blogspot.com/2011/10/crash-reporter-for-ios.html

Related

The Firebase crash reporting on iOS not send the report after the crash

I have configured the Firebase Crash Reporting. When I test it with code:
assert(true);
The report was sending.
When I use the next code for the test crash the app:
NSArray *array = #[#(123),#(312)];
array[5];
The report is not sending. I'm confused(
All code adds into AppDelegate after the
[FIRApp configure];
I tested this scenario and it worked fine for me. let me explain it in two steps.
Step 1:
NSArray *array = #[#(123),#(312)];
array[5];
add the code in application:didFinishLaunchingWithOptions function and after that, build the application. It will crash for sure.
Step 2: Stop the application and open the simulator and run the application from the simulator not from Xcode.
Step 3:
// NSArray *array = #[#(123),#(312)];
// array[5];
comment the code which is causing the crash and run it from the Xcode.
if all work well then this message will be shown "Firebase Crash Reporting: Crash successfully uploaded" in the console of Xcode.
Hope it helps.
Let me know if there is any problem.

your app loads indefinitely upon launch

I have an app which works fine on below devices.
iPhone 4s (iOS 7.1)
iPhone 5 (iOS 9.1)
iPhone 6 (iOS 9.1)
However app is rejecting saying below rejection.
We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 9.1 on both Wi-Fi and cellular networks.
App did not load its contents, did not load beyond the flash screen.
However when I run this from my side, its working fine but it has problem at Apple end only. I don't know how can app run at my end and its giving problem at Apple end only? I tried to upload with iOS 8.4, but still Apple reply still we can't go beyond splash screen.
Did anyone face such issue OR does anyone point me where I can be wrong?
I have uploaded 6 builds and all are rejected saying same reason.
Note: Same app was working fine earlier (before iOS 9.1 release), but when I try to upload now, it is giving this error.
The biggest challenge for me is, I don't know what is the problem, but I need to FIX this problem
Edit 1
I have first screen as language screen where I have animation of images.
animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1080, 1920)];
animationImageView.hidden = NO;
animationImageView.animationImages = mArray;
animationImageView.animationDuration = 1.5;
animationImageView.animationRepeatCount = 1;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
After testing on testflight, I found a problem.
If I open the app after clicking app icon, it was working fine.
The problem comes when I click Open button from testflight
When I click Open button, launchOptions in AppDelegate was not nil, so the code in push was going wrong and internally it was crashing but still app was hanged at splash screen (not sure why though)
Below is what I have when I print launchOptions in AppDelegate didFinishLaunchingWithOptions
launchOptions==={
UIApplicationLaunchOptionsSourceApplicationKey = "com.apple.TestFlight";
}
So I changed my code to below and all is working perfectly.
NSLog(#"launchOptions===%#", launchOptions);
if (launchOptions!=nil) {
NSMutableDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(#"userInfo===%#", userInfo);
NSLog(#"userInfo===%d", userInfo.count);
if (userInfo.count>=1) {
// here is my code on what to do if i click on push
}
}
Do let me know if someone is not clear
It was crashing saying below
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
So I feel problem was at line below.
NSString *badge =[[NSString alloc] initWithFormat:#"%#", [apsInfo objectForKey:#"badge"]];
But after putting above condition, all was working fine.
Did you test using "Run" from Xcode, or using Test Flight? Test Flight gets you the app in the same environment as Apple gets it, while running directly from Xcode may yield different results (different push notification environment, possibly different compilation options...).
Also, do you have access to the logs of the server that the app queries? If so, have you checked them to see what happens when Apple try to use the app? Is the query correctly formed? Was there an error (status code different from 200, or in the error log)?
What kind of request does your app perform? Is it a regular http(s) request? Or are you using an unusual protocol which may be blocked somehow?
I suppose the server queried is fully reachable from the Internet (i.e. you did not put a server that is only accessible on your local network)?
You should add error handling in your code, to test the result of requests and display information about it, so that if there's an error when they test it, at least they can report what the error is.

Why does not executing the following code cause it to crash?

I have an app that uses Admob. But since I am supporting versions of iOS 5 and above, I make sure that I don't call Admob code in versions below iOS 6 by doing the following:
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_5_1) {
int j = 2;
j++; //This is just some code so I can use breakpoints for testing.
NSLog(#"Google Mobile Ads SDK version: %#", [GADRequest sdkVersion]); //Commenting out the line prevents the crash
}
I am testing on iOS 5.1.1. Now if I comment out the NSLog, line, the app works without problem. But if I uncomment it the app crashes almost immediately within the main method:
int retVal = UIApplicationMain(argc, argv, nil, #"AppController");
I guess its not crashing when it is commented out because the compiler "optimises out" the code since its not used. But then what is the correct way to make sure the code isn't used, and the app doesn't crash ?
EDIT: I edited the code, the if block is not optimised out:
int j = 2;
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_5_1) {
j++; //This is just some code so I can use breakpoints for testing.
NSLog(#"Google Mobile Ads SDK version: %#", [GADRequest sdkVersion]); //Commenting out the line prevents the crash
}else{
j--;
}
NSLog(#"%d",j);
The output is "1", so the code in the else block executes. So even thought the function call [GADRequest sdkVersion] is not made, why does it crash ? Again, if I comment out the function call the app does not crash.
One possibility that is consistent with what you're describing is that linking to AdMob causes the crash. Sending a message to the GADRequest class in your code causes it to link to the GADRequest class, whereas if you didn't, it wouldn't link to it.
Why does linking to AdMob cause the crash? Most likely it's because AdMob links to several system frameworks, some of which may not exist on iOS 5 (e.g. AdSupport framework), so when it tries to dynamically link to them on app startup, the dynamic linker crashes.
I'm not sure what you can do. Maybe you can try explicitly linking to the system frameworks that AdMob use as "optional" in Xcode? (I haven't tested it.)
Otherwise, you could downgrade to a version of AdMob that supports iOS 5 (according to the release notes, any version before 7 should do).
I dont know why it crashes - but don't support iOS 5. It is pointless. The iOS market split is something like 20% iOS7, 80% iOS8. You cannot buy iOS5 phones, and you cannot install or, or even release apps for it.

Xcode console wont show error details

I have been developing iOS applications for about 2 years and have never come across this before.
I recently took on a project, but for some reason whenever it crashes while I am debugging the console shows no details about the error. The code highlights with a SIGABRT or ESC_BAD_ACCESS but never tells me the details of the crash in the console (like unrecognised selector sent to instance etc.)
I've come to the conclusion this is a problem with the project settings as I test other apps with the same xCode and don't have the same problem.
I've looked all over but can't find anyone with a similar problem please help!
Try adding an Exception breakpoint:
Open the breakpoint navigator and click the + icon and add an exception breakpoint
Add a breakpoint with the settings as shown
I don't think this is an Xcode problem. But try this two options:
1) In your VC or AppDelegate perform crash on purpose for example:
[self performSelector:#selector(methodNameNotExistingInMyProject:) withObject:nil];
This should return you some console output
2) Are you sure you have Debug configuration in scheme? You may want to check it out.

EXC_BAD_ACCESS in device, not in simulator

I have implemented adwhirl in my project. I have implemented it previously in my projects, so I just incorporated it into my current project from my previous.
- (UIViewController *)viewControllerForPresentingModalView {
{
return self;
}
I had used this in my previous projects..since my window.rootvviewcontroller was self only. But in my current project there are many screens on which I am showing ads, so I have used:
- (UIViewController *)viewControllerForPresentingModalView {
{
return return [[(AppDelegate *)[[UIApplication sharedApplication] delegate] window] rootViewController] ;;
}
The main problem is the program was crashing, and still is. At first everything was okay: iads test ads loaded up, but it crashed rarely. I soon understand it was because of Admob. It crashed rarely because admob ads were not loaded most of the time.
Now searching for these crashes, I came across a point that since I have made the project in Xcode 4.2 rather than my previous projects Xcode 4.0 there were strong attributes in my window and view controller. I removed it.
Now the problem is in simulator it doesn't crash but it crashes in device.
The error is after I have added adview as a subview and it has - (UIViewController *)viewControllerForPresentingModalView went through this function but before adWhirlDidReceiveAd method.
The actual crash is [GADRequestPrivate spamSignals] EXC_BAD_ACCESS.
Below answer has already earned bounty for me :) ..... you can try for your problem...
Link : Getting to the bottom of crash
I found one of the best way to Debug the code for Crash. Follow the link for Debugging technique:
http://www.cocoadev.com/index.pl?DebuggingAutorelease
You need to analyze your Console very carefully to see actually why the Crash occurs. This helped me in almost all of the Code that are without ARC enabled.
I recommend you analyze your project and look for memory leaks and zombies. It seems like you are sending a message to a released object which causes the invalid memory access. The zombies detection cannot be run on the device, but you can run it on the simulator. Take a look at Xcode Instruments - Enable NSZombie Detection? Where is it?
Hope it helps.
Even if this happens in proprietary Adwhirl code, you can learn a lot by turning on all the debugging flags as specified, for example, in How to break on __NSAutoreleaseNoPool. This answer discusses lots of debugging flags, not just autorelease pool ones.

Resources