Xcode 6.1 builds crashing on device - ios

I recently made the mistake of upgrading to Xcode 6.1 (release version - 6A1052d) from 6.0.1 where everything was working fine. Upon first loading the project, I immediately had numerous errors, which I corrected by removing ?s or adding !s and commenting out an Apple supplied line from the persistent store coordinator in the app delegate:
// error = NSError.errorWithDomain("YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
My app now runs fine in the simulator, but on my device it crashes almost immediately after the build succeeds and takes me to lldb with almost no useful information. Currently it crashes on my first println statements, but I've tried bypassing things and it will still crash on simple variable declarations or println. I've tried updating my iOS, deleting the old app from my devices and restarting the devices. Any advice would be appreciated.

I'm still not sure what caused this problem in the first place, but I deleted Xcode, re-downloaded it, installed it, reloaded my old project, re-fixed my errors and the project is running now running on devices in the newest version of Xcode.

Related

Xcode 9 crashing when running split view app on iPhone

After working just fine on both iPhone and iPad for a month, my Xcode 9 app has consistently started crashing causing me the following fatal problem: When I build & run it on an iPhone (simulator or device) Xcode completes loading the app and then crashes too fast for me to copy/paste the error from the debugger. When I run on iPad it works fine leading me to believe this is a result of something related to the split master/detail view.
If I use either an exception breakpoint or an "all C++ exceptions" it will stop at the AppDelegate class and crash if I hit play. If I use only an "all Objective-C exceptions" it will crash as before.
In the debug view hierarchy I get the following errors as well:
Error: Unable to capture view hierarchy.
Details: Log Title: Data source expression execution failure.
Log Details: error evaluating expression “(id)
[[(Class)objc_getClass("DBGTargetHub") sharedHub]
performRequestWithRequestInBase64:#"...
Log Method: -[DBGDataSourceConnectionLibViewDebugger
_executeLLDBExpression:forRequest:onPotentialThread:iteration:]
_block_invoke_2
Method: -[DBGViewDebugger updateDebugHierarchy]_block_invoke_2
I have tested other apps and this issue is unique to the app I am working on. Any ideas or debugging tips for how to proceed? I might just have to redo this whole project again if I can't even find the root cause of this! Appreciate any help.
Quick solution: Reset Simulator Device
I managed to resolve the above issue thanks to some serious digging. First, to resolve the instantaneous crash problem, I set a breakpoint at every line in the app delegate. That allowed me to narrow the error to a memory handling problem. From there I started running the code on one of each device available, and realized the crash only occurred on devices I had used earlier in development. Resetting those devices solved the problem.
The core issue here is that when you clean/rebuild your xcode program, it updates the app code on the device, but not necessarily the data model information. So when I changed my data model by including new data and renaming old data it was not properly updated.

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/ .... '

I get this error in the debugger everytime core data is used (so if I make 3 calls I get the warning 3 times).
CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/0B6C2326-D8D5-47B3-8C68-7693C16A0806/liveDemo.app/liveDemo.momd/liveDemo.omo'
It does not cause any instant problem, but whilst they add up, it gradually slows down the app until it crashes with a NSException (it's irrelevant what the user does at the time, it will just lag more and more then come to a crash at whatever point in the app).
I have tested the app on 3 devices (iPhone 7+ - iOS 11, iPhone 7 - iOS 11, iPad Aid - iOS 10.3) and it ONLY occurs on the iPad. However when I started the project one of the phones had a version of iOS 10 installed and it did not cause any issues so although I can't fully exclude it, it seems unlikely it's the OS version to blame.
Steps tried
Uninstall and install app, so the device clears core data file, also tried restarting with and without the app installed - FAILED
Remove and rewrite the Scheme in Xcode - FAILED
Recreate the NSManagedObjectSubclass of the datamodel - FAILED
Has anyone encountered anything similar with recent versions of Xcode and managed to fix it? This is a 2 year old similar problem, but none of the answers have helped.
So, after a few days I have managed to solve it. I'm not familiar enough with the insides of Xcode, but all I had to do was rewrite the CoreData Model. Best to make a back up before trying this!
Take a screenshot of current attributes and delete the CoreDataModel ( .xcdatamodeld file)
Add a new file to project (Data Model template)
Write old attributes
Recompile and build
My assumption would be that the problem was caused after migrating a project started in Xcode 8 (written in Swift 3) to Xcode 9 (upgraded to Swift 4). It had no problem with devices running iOS 11 (same upgrade level as Xcode 9), but found it to consistently cause lag and eventually crashes in older iOS versions.
I don't understand why simply modifying file properties did not fix it, but I'm happy to have fixed it and move on.

Xcode 8.2.1 & Swift 3.0.2 + Realm 2.4.x = Fatal Exception Crash

So my Swift-based iOS app with no other non-native dependencies besides Realm is crashing fatally since Realm 2.4.
I first installed Realm 2.4.1 yesterday, saw the crash, and rolled back to 2.3 thinking it was a bug, so this is definitely occurring only with Realm 2.4 and onward.
But I just installed Realm 2.4.2 today, and I'm getting the same crash, which I can't figure out the cause of due to lack of information provided after the crash (empty debug console, nothing odd I can identify in threads).
When I remove the app from the simulator and then build from scratch, the crash occurs on the last line of my Realm setup code with an EXC_BAD_ACCESS (code=1, address=0x0) error:
currentReminders = currentTab.reminders.sorted(byKeyPath: "reminderPosition", ascending: true)
On subsequent builds/launches without removing the app from the simulator, the crash and error message are the same, but it happens in a different place, though even then, it's on a line that attempts to get reminders from the reminders property in my currentTab object, which is a list of reminder objects.
Has anyone else encountered this or similar crashes since upgrading to Realm 2.4?
Please try performing a clean build. We've seen reports of Xcode failing to rebuild enough of the app when updating Realm versions, resulting in mysterious crashes. A clean build addresses those problems.

App crashes before debugger can connect

I've got an app that crashes even before the debugger can connect.
I placed a break point on the first line of main(). (I added an NSLog statement as very first statement in main() and set the break point there.
The app seems to start. The main screen with some ui elements becomes visible on the screen. Then it disappears.
There is no crash log found on the devices.
Xcode message:
Could not launch "appname"
process launch failed: failed to get the task for process xyz
Debugging is enabled of course.
The same for the profiler Instruments.
Code signing works fine so that the app can be deployed to the devices.
(Same for enterprise distribution. And the app validates for store submission.)
It does work on the simulator though.
The app used to work fine. I was just about to build it for the store. For final tests on iOS 8.1 I upgraded to Xcode 6.1 with SDK 8.1. But the problem did not occur directly after the upgrade. It worked just fine.
Then it crashed when building for release for enterprise distribution.
The AppStore build crashed in the same manner (according to Apple, the app was rejected of course.)
But it ran nicely in debug modes.
Now I was trying whether compiler options for optimization may make all the difference and I was trying to build in release mode with debugging enabled etc and end up with a debug build crashing as well. (No optimization in debug).
So it may well be that the migration to Xcode 6.1 did cause it but the problem may have come effective only after Xcode cleaned and rebuild the project in response to changes to compiler settings for code optimization.
Sorry for the long text. I tried to put everything in that may be of importance.
Reason is most likely some incompatibility of Crackify and iOS 8.1.
Therefore it may be of interest for others, altough my problem along with these symptoms may be very special.
Very early within AppDelegate didFinishLaunchingWithOptions we have had the following statement.
if ([Crackify isCracked] || [self isCertificateUnvalid])
exit(173);
That, as such, is not really well designed. The app is just terminated rather than any error message displayed to the user. Thus, it appears as if the app has crashed. But it has not crashed and therefore no crashlog is provided.
For reasons which I don't yet understand and which may not be related to this error, my debugger did not manage to hook up into the executed app. Once that was overcome (suddenly the debugger worked without any changes made to any of the debugging related settings) the error was found rather quickly.
This is Crackify: https://github.com/itruf/crackify
Within Crackify it was this code sniplet that caused the problem:
static NSString *str2 = #"ResourceRules.plist";
BOOL fileExists3 = [manager fileExistsAtPath:([NSString stringWithFormat:#"%#/%#", bundlePath, str2])];
if (!fileExists3) {
return YES;
}
For reasons that I did not further investigate, the file, that is tested here, apparently does not exist in iOS 8.1 any more.

App crashes without reason with xCode 4

Something weird is going on here.
My app crashes on this line of code:
int end = NSMaxRange(endRange);
but I don't get any error message, and everything is fine: endRange. The app just freezes in the iPhone and that's it.
1.
The weird thing is that the same code was working before, and I've reversed from repository to see what's wrong but it still doesn't work.
2.
Also xCode removes the breakpoint every time the app crashes. I add it again, I run the app, I step over, the app crashes and Xcode removes the breakpoint.
3.
I've cleaned the build, restarted xCode, restarted the iPhone, removed the app from the iPhone. Same issues.
4.
If I don't use breakpoints, the app doesn't crash, but the code right after that line is "skipped", but it was working before. At least the app doesn't freeze without breakpoint.
What the hell ?
I've had similar problems with the debugger in the past too. Try switching from LLDB back to GDB (From the Product / Edit Scheme menu). I've found LLDB to do exactly what you are describing with breakpoints.

Resources