iOS 7 migration help - Runs in Simulator, but not on device -- app does not load - iphone

Disclaimer: I'm helping out on another developer's code (he didn't have the time and the customer wants it fixed quickly) and so I'm not totally familiar with this code.
So the app is built for iOS 6, is in the App Store, and runs great. Until you try opening it on a device running iOS 7 GM. You see the splash-screen for a moment, then it crashes completely. This is causing problems because none of our users can use the app anymore after updating.
I just got the source code and I have been trying to figure it out. It compiles fine, and even runs in the iOS 7 simulator. (Although, of course, the UI needs to be redesigned for iOS 7.)
Here's where it gets weird: when I run it on my iPhone 5 (iOS 7) from Xcode, the app hangs (just like with the App Store version, of course) -- but it's just so weird, considering that in runs in the Simulator.
Good news is that I have some runtime errors that might help to track down the problem. I ran a search that indicates it could be a missing connection in a xib file, but I didn't find one.
Here is the log. If it helps, I can also include the build warnings.
2013-09-20 20:16:55.455 myappname[2514:60b] * Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
* First throw call stack:
(0x2e3d0e8b 0x386ca6c7 0x2e3d0dcd 0x307d5feb 0x307d5eef 0x307d5e7f 0x30b53517 0x30b6373b 0x30c042f1 0x30b56533 0x307ddf43 0x307d9767 0x30b6b411 0x30b67ed5 0x30be7501 0x30be71a1 0x30c03685 0x30bcf53d 0x30c034bf 0x30b55f3d 0x30b55d19 0x30b55609 0x2ed32143 0x30b55495 0x30b62153 0x30b61bd3 0x30c43e13 0x30c8398b 0x30c83961 0x30c82abf 0x30c82663 0x30c8256f 0x5c4d7 0x30bc7425 0x30bc6e6b 0x30bc14b9 0x30b5bbe7 0x30b5aedd 0x30bc0ca1 0x3303c76d 0x3303c357 0x2e39b77f 0x2e39b71b 0x2e399ee7 0x2e304541 0x2e304323 0x30bbff43 0x30bbb1e5 0x5b485 0x38bc3ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
Thread 1: signal SIGABRT
I really have no idea what is going on.
Any help would be greatly appreciated :)

try to use preferredContentSize to define view size.

Related

ARKit crashing in iOS 11.3

Since iOS11.3 I'm getting a significant number of new crash reports from my AR measurement app.
The crash description says:
Exception Type: SIGABRT
Exception Codes: #0 at 0x181b112ec
Crashed Thread: 0
Application Specific Information: *** Terminating app due to uncaught exception 'std::invalid_argument', reason: 'extrinsicTransform must have determinant 1.'
The crash is triggered by this line in my code, which is called on didUpdateFrame
NSArray<ARHitTestResult *> *resultArray = [_arsnView hitTest:position types:ARHitTestResultTypeExistingPlaneUsingExtent | ARHitTestResultTypeEstimatedHorizontalPlane];
According to the crash reporting, it happens to about 10% of the sessions (!!!!). Before iOS11.3, I had <0.1% crashes.
I tried feeding the hitTest with different values for position, including NaN etc, but I'm not able to reproduce the crash.
Any ideas?
Thanks!!
UPDATE 1
I checked that the currentFrame is still valid when calling the hitTest. Despite checking this with if(_arsnView.session.currentFrame), the app still shows the same crash :(
Thanks for your help. I found that checking the trackingState before performing the hitTest, resolves the crash. So basically, I'm checking:
if (_arsnView.session.currentFrame.camera.trackingState!=ARTrackingStateNormal)
{
// do not perform hitTest
}
else
{
// perform hitTest
}
In this example, _arsnView is a property from class ARSCNView
Anyone log a bug for this for 11.3? Getting the same effect trying to test an application with 11.3 on an iPhone X
My apologies for the earlier one, last night I was too sleep deprived.
Anyway, I raised a TSI for Apple, and they came back with the following.
Thank you for contacting Apple Developer Technical Support (DTS).
This a known issue when you perform a hit test and the ARCamera’s tracking state is either .notAvailable or .limited.
<https://developer.apple.com/documentation/arkit/arcamera.trackingstate>
The workaround is simply to not hit test when in either of those tracking states. This is also a best practice.
I hope this information suffices to address your concern to your satisfaction.

ADBannerContentSizePortrait not available on iOS 5

I am adding the iAd framework to an existing application. The application is portrait only and iPhone only. Everything is running in iOS 6, both in the simulator and on an iPhone 5. However, it fails in iOS 5 both in the simulator and on an iPhone 4. It throws the following exception:
'NSInternalInconsistencyException', reason: 'currentContentSize must be one of the requiredContentSizes; 'ADBannerContentSizePortrait' is not in {(
ADBannerContentSizeLandscape
)}'
The exception is thrown on this line:
iAdBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
I see no way of displaying anything other than a landscape banner this way. I'm assuming I must have something configured wrong somewhere, but I don't know where, and find it curious that it works fine in iOS 6.
Any help here is greatly appreciated! Thanks!
UPDATE: I can't answer this because I don't have enough rep points. But I have it fixed:
Background: I'm using the Kobold2D wrapper around ADBannerView. It's class, KKAdBanner, is the one that is actually calling the line causing the error. It turns out, it was preceding this call by configuring ADBannerView to only allow landscape sizes. This was a configuration issue and I can resolve it.
Of course, now I don't know why in the world it ever worked in iOS 6 at all, but oh well :-)
I've never used this, but from what I'm understanding from the documentation you need to set the #property(nonatomic, copy) NSSet *requiredContentSizeIdentifiers
with all the value that currentContentSizeIdentifier could take.
And your exception is saying that in that NSSet you only have the one for the landscape.
The difference you are seeing could be due to a different default values in different iOS version. (I'm guessing)
Reference here.

App works on iPhone but crash on iPad simulator stuck with launch image on ipad

I am very new to this and hope I am at the right tread asking the right question.
My app has been in the AppStore for a couple of weeks now and always only worked on iPhone. it was rejected because the App does not run on an iPad. The exact reason it was rejected was:
Reasons for Rejection: 2.10: iPhone apps must also run on iPad without
modification, at iPhone resolution, and at 2X iPhone 3GS resolution
When run on iPad 5 simulator, the following error occurs:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
* First throw call stack:
(0x1ba5022 0xf60cd6 0x1b9233e 0x1b931f0 0x18bc04 0x19724f 0x3c3c 0x18a99b 0x418e 0xfd9d4 0xfdbe0 0x4155 0x15159 0x1433f 0x3b18 0x2b0d 0xc1386 0xc2274 0xd1183 0xd1c38 0xc5634 0x14d0ef5 0x1b79195 0x1addff2 0x1adc8da 0x1adbd84 0x1adbc9b 0xc1c65 0xc3626 0x2a60 0x29c5)
terminate called throwing an exception
What do I need to do in Xcode 4.5.1 to make my app run on an iPad?
Do not insert a nil into an array. If you want to express that there is an "empty" object, use the singleton NSNull: [myArray insertObject: [NSNull null] atIndex: myIndex];.
* EDIT *
In case you did not use such code by intention, you should seek for automatic platform-dependent code. Hot candidates are missing or misconnected outlets or actions, platform-specific bundles, or missing or wrong (i.e. with incorrect IDs) elements in NIB/storyboard. However, without seeing your code, everything is guessing. Try to detect the fault by identifying the last place in the code trace, that belongs to your code (not library/framework code).
For Cordova developers, you will get this error if you supply anything in the "Main Interface" dropdown in the General Project Settings. Always leave this blank if you want to target all platforms with a Cordova app.
You can also click all four orientations if you like. Also make sure "Universal" is selected in the devices dropdown.

Xcode: debug unexpected iOS app crashes

I'm facing unexpected crashes of my app running on an iPhone 4 with iOS 5.0.1, the app crash without generating any error message nor crash log. I did also enabled zombies and tested with Instruments with no luck... how can I figure out where is the problem? I'm totally stuck :(
ps. I'm using ARC and my app is multi thread (NSOpertations + GCD)
(By popular demand:) There are some hints for catching the failure in this thread.
From the breakpoint-menu in Xcode, press the little '+' button at your window bottom left, and add an exception breakpoint. It will give you a heads up if the app throws an exception due to erroneous code.
Just follow this url you will get trick to track the causes of crash.
add some breakpoint before crashing point and add a lot of NSAssert to check your assertion.

How to debug EXC_BAD_ACCESS on device only

I have some code that returns a struct containing 2 objects (declared as id).
When trying to use one of the objects I get an EXC_BAD_ACCESS and the app crashes. This only happens on the device (ipad) not in the simulator.
I have set NSZombieEnabled to YES, however no information is written to the console.
I don't know if it's a problem that I'm using a workspace in Xcode 4, one project for my app, and another that builds a library which is used in my app. The EXC_BAD_ACCESS is occurring in the second project, so I don't know if NSZombieEnabled will apply to the second project?
How do I solve this? Especially as I it only happens on the device (even goes as planned on the simulator), and it is in the second project?
EDIT: This is the method where the EXC_BAD_ACCESS occurs, on line 62, on sortRange.lower –
NSZombieEnabled only works on the simulator, not on the device, so it's probably hiding the problem. Run Product > Analyze (⇧⌘B) for clues. It's harder to say more without looking at the code. As Mihai says, your objects are probably over released, which is the most common cause of EXC_BAD_ACCESS.
It seems that one of your objects is autoreleased before you are trying to access it. As the iPad has less memory than the computer you are running it on it get's released faster so that's why it's not available. Try NSLog both objects just before the line you are getting the error and see wich one of them is the problem and than trace back to it's origin and retain it somehow. Also don't forget to release it after you are done using it. Some example code would be useful.