Crash on closing app in OS X 10.6 and 10.7 only - objective-c

There is a bug which only happens to my app on OS X 10.6 and OS X 10.7: the app crashes on closing.
Explaining it better: when the user closes the app window (closing the app by consequence) the user see a crash dialog, which means that the app crashed while closing.
I've managed to get the help of an OS X 10.7 user to use a Debug version of the app, imagining it would produce a crash log easier to understand, however nothing changed.
Process: MyApp [838]
Path: /Applications/MyApp.app/Contents/MacOS/MyApp
Identifier: MyApp
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: MyApp [650]
Date/Time: 2016-07-20 17:38:24.043 0200
OS Version: Mac OS X 10.7.5 (11G63)
Report Version: 9
Crashed Thread: Unknown
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007fff5fc01028
Backtrace not available
Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000055 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x0000000000000000
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x00007fff5fc01028 rfl: 0x0000000000010203 cr2: 0x00007fff5fc01028
Logical CPU: 0
Binary images description not available
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 316
thread_create: 0
thread_set_state: 0
From Report Version and beyond, everything is always precisely the same, except for the task_for_pid.
I know it doesn't affect the program use since it only happens after the program closure, however it surely must be a pain seeing a crash report every time you close an app.
Remembering that this bug doesn't happen with OS X 10.8 or superior versions, and that I'm using the 10.11 SDK.

Finally I solved the problem. Despite OS X saying the crash belonged to my app, it wasn't exactly that. In my applicationWillTerminate: function I was running a binary throw NSTask, however that binary was compiled to be 10.9+ compatible, and that was causing the crash.
Rebuilding the binary with OS X 10.6 as the target version fixed the crash. Partially like #Willeke suggested, I installed Snow Leopard on my Mac (dual boot) in order to test my app in it, so now I will test it in Snow Leopard and El Capitan; the oldest and newest (while Sierra don't get a stable release).
I don't know why that bug didn't happened in OS X 10.8 as well; probably Apple has changed the way the system should behave to that kind of problem.

Related

Xcode 6.1.1 Instruments Can Not Use Counters Template on Devices

XCode 6.1.1 Instruments 6.1
Can use the Counters template fine on Simulator, but not on devices. Get the warning / error message:
"The current OS does not have support for your CPU"
The Red Button is greyed out and can not start the session.
Can only run Counters on the Simulator?
This is from an XCode PRODUCT / PROFILE with target as a device and not a simulator.
iPhone 4 and iPad Mini both exhibit this problem.
The current version of Xcode, currently 7.2.1 as of this writing, apparently only supports 64-bit processors when using Counters. For 64-bit, you'll need an Apple A7 or newer so the following are currently the minimum supported devices:
iPhone 5s
iPad Air
iPad Mini 2

How do I symbolicate a crash log for armv7 on iOS 8.1.1

I've got some crash logs from a user running iOS 8.1.1 on an armv7 device. Xcode will only symbolicate the lines from my app, and when I try to do it by hand I get lots of errors like this:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: file: /Users/sgb/Library/Developer/Xcode/iOS DeviceSupport/8.1.1 (12B435)/Symbols/usr/lib/system/libsystem_kernel.dylib does not contain architecture: armv7
Can't understand the output from otool ( -> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -arch armv7 -l '/Users/sgb/Library/Developer/Xcode/iOS DeviceSupport/8.1.1 (12B435)/Symbols/usr/lib/system/libsystem_kernel.dylib')
I'm told that Xcode will symbolicate the crash logs if I can find an arm7 device running iOS 8.1.1. I have an arm7 device running vanilla iOS 8.1, and two hours they released iOS 8.1.2, so I can't get 8.1.1 onto it.
So what do I do? I can't ask the user to upgrade and get me more logs. How do I symbolicate the crash logs?
The issue is that Xcode 6 does not seem to have shipped with armv7 libraries for iOS 8. Compare these two dwarfdumps:
dwarfdump --uuid /Users/xxx/Library/Developer/Xcode/iOS\ DeviceSupport/8.1.1\ \(12B435\)/Symbols/usr/lib/system/libsystem_c.dylib
UUID: 415DBD55-796D-3413-819F-59EE8ACEBDA2 (armv7s) /Users/xxx/Library/Developer/Xcode/iOS DeviceSupport/8.1.1 (12B435)/Symbols/usr/lib/system/libsystem_c.dylib
dwarfdump --uuid /Users/xxx/Library/Developer/Xcode/iOS\ DeviceSupport/7.1.2\ \(11D257\)/Symbols/usr/lib/system/libsystem_c.dylib
UUID: 17AEC0BF-EB49-3308-9292-4005DC41C50E (arm64) /Users/xxx/Library/Developer/Xcode/iOS DeviceSupport/7.1.2 (11D257)/Symbols/usr/lib/system/libsystem_c.dylib
UUID: 5DA46A1B-0620-36F6-9C19-32E4EC6695FB (armv7s) /Users/xxx/Library/Developer/Xcode/iOS DeviceSupport/7.1.2 (11D257)/Symbols/usr/lib/system/libsystem_c.dylib
UUID: 371F0E18-54F0-3B05-BA14-3619E4EAC99F (armv7) /Users/xxx/Library/Developer/Xcode/iOS DeviceSupport/7.1.2 (11D257)/Symbols/usr/lib/system/libsystem_c.dylib
I tried for 8.0 as well, and got similar output as I did with 8.1.1. This leads me to believe that Apple just said "screw it" for armv7 devices for iOS 8 onward.
I poked around and it doesn't look like you can download any such libraries anywhere :(
Please correct me if you find out otherwise.

App crashed on IOS 7.0 works fine on 7.1

I have built an app that works well on IOS 7.1 but when installed on IOS 7.0 it crashes with the following logs:
dyld: lazy symbol binding failed: Symbol not found: _OSAtomicDecrement32
Referenced from: /var/mobile/Applications/80FCE91D-EAB5-4321-A157-4A05EA40C07C/MyAPP.app/MyAPP
Expected in: /usr/lib/libSystem.B.dylib
Aug 16 14:42:00 LAWR3NCEde-iPhone MyAPP[14925] <Notice>: dyld: Symbol not found: _OSAtomicDecrement32
Referenced from: /var/mobile/Applications/80FCE91D-EAB5-4321-A157-4A05EA40C07C/MyAPP.app/MyAPP
Expected in: /usr/lib/libSystem.B.dylib
The app uses Facebook SDK and MSDynamicsViewController (Which uses UIKit). Any idea what this message mean ? And what is this OSAtomicDecrement32 ?
OSAtomicDecrement32 is in OSAtomic.h. It is useful when implementing locks or retain counts in a multi-threaded program.
It's marked as being available on 7.1 and up only (on iPhone) which is why you are crashing.
__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_7_1)
int32_t OSAtomicDecrement32( volatile int32_t *__theValue );

App crashes on some devices after update

Im experiencing something strange while updating my app in the Appstore. Version 1.4 worked fine for every device. However Version 2.0 crashes on some devices when updated. The loading screen wouldnt even show when starting up and the app would crash within a second. Removing and reinstalling the application from the app store solves this problem. Again this only happens on some devices (iPod, iPhone 4, iPhone 4s, iPad so far).
I manages to get my hands on a crashing device and check the Device logs. Also I think I found something but I cant really understand the error. It says:
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/AdSupport.framework/AdSupport
Referenced from: /var/mobile/Applications/(ID)/AppName.app/AppName
Reason: image not found
Dyld Version: 199.6
I added AdSupport.framework because I implemented Facebook in my App in version 2.0 and the file is in my project in the folder 'Frameworks'.
Does somebody know how to fix this?
Here is the full crash Report if useful.
Incident Identifier: ID
CrashReporter Key: crash key
Hardware Model: iPod4,1
Process: AppName [35491]
Path: /var/mobile/Applications/id/AppName.app/AppName
Identifier: AppName
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-03-05 23:23:35.041 +0100
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread: 0
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/AdSupport.framework/AdSupport
Referenced from: /var/mobile/Applications/(id)/AppName.app/AppName
Reason: image not found
Dyld Version: 199.6
Binary Images:
0x7a000 - 0x106fff +AppName armv7 <0c108dce50ee3e65970e2538a3e319f8> /var/mobile/Applications/(id)/AppName.app/AppName
0x2fe79000 - 0x2fe9afff dyld armv7 <77eddfd654df393ba9c95ff01715fd08> /usr/lib/dyld
0x3075a000 - 0x307d9fff libsqlite3.dylib armv7 <bf01f5ed47b033d8bde30d735ff44416> /usr/lib/libsqlite3.dylib
0x3113c000 - 0x311a0fff MessageUI armv7 <da7af4f9494b35558bf7892dfdb36ee3> /System/Library/Frameworks/MessageUI.framework/MessageUI
This iPod has iOS 5.1 but I also received report on iOS 6.1
Because AdSupport.framework, is ONLY available on iOS 6. So Dyld cannot find something who doesn't exist on past IOS. Even if you are adding framework into your project, you don't actually include the binary, only the reference.
If it's not crashing when you are reinstalling your app, it's because maybe it doesn't use the adSupport functionality at that time. But i'm not sure of this theory because i haven't made your code ;)
Here the apple available framework link, hope it will help you
http://developer.apple.com/library/ios/#documentation/miscellaneous/conceptual/iphoneostechoverview/iPhoneOSFrameworks/iPhoneOSFrameworks.html

XCode: application->iPod Run/Build not uploading app

Xcode says it builds and finished running on my iPod except the app is not on my iPod.
Using Xcode 4.2.1 on Mac OS X 10.7.2
also note that the xcode"log navigator" shows a number of the build/debug instances with status wheels spinning.
On the organizer I get the following repeating:
Sun Jan 1 15:34:53 unknown com.apple.mobile.lockdown[16] <Notice>: Could not receive size of message
Sun Jan 1 15:35:53 unknown lockdownd[16] <Error>: 2ff68000 handle_connection: Could not receive USB message #6 from iTunes. Killing connection
I have disconnected, closed programs, rebooted the Mac, and still get the same problems.
note: This answer assumes you will be able to run your app on an iPod touch. If you are using a resource not available on an iPod touch, like GPS for example, you may be being prevented from running your app by a GPS device requirement(see required device capabilities).
This sounds like a classic example of trying to run on an iPod touch 1st or 2nd gen without jumping through the apple imposed hoops. (Says finished running but never runs, logs are just spinning indicators.)
To build for these older devices, you must jump through these hoops:
How to add support for iOS 4.2, armv6 in Xcode 4.2 and up:
Set your deployment target to 4.2 or earlier:
Modify Architectures to include armv6 like so:
1)Select Other,
2) Click on the "+" button,
3) Type in "armv6",
4) Click done.
Then remove armv7 from required device capabilities by clicking the "-" button in that row.
I personally use this method constantly to run apps on my iPod touch 2nd gen with the newest Xcode.
In fact the project that I used for this example now runs on that iPod.