iOS app crashes on first load on device - ios

XCode 4.2 with iOS 5
My app will only crash on the first load on a real device while debugging. If I run it in the simulator, it always works. And every time after the first time on the device itself, it always works fine.
Once I delete the app from the phone, the next launch of the app will crash EXC_BAD_ACCESS but I cannot tell where this is happening even while debugging.
The app failed submission to the app store for this reason. All I can say is that it happens RIGHT before the dialog: "MyApp" Would like to Use Your Current Location
Then when I re-launch it, it works fine.
Here is the crash log, but it doesnt seem to tell us much:
Incident Identifier: 2E1B994F-6783-4C3E-8463-F21B4AD0BE9D
CrashReporter Key: d4365cbed4fa63fb6536c6c6925416357a62e6e7
Hardware Model: iPhone3,1
Process: MyApp [4205]
Path: MyApp
Identifier: MyApp
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-02-12 11:09:17.223 -0800
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x35e85f30
Highlighted Thread: 0
Backtrace not available
Unknown thread crashed with ARM Thread State:
r0: 0x00000000 r1: 0x007f3000 r2: 0x60000000 r3: 0xfffff000
r4: 0x60000000 r5: 0x007f3000 r6: 0x00000907 r7: 0x2fdfe780
r8: 0x3eac9690 r9: 0x31bcc104 r10: 0x00000106 r11: 0x00000080
ip: 0xfffffff3 sp: 0x2fdfe774 lr: 0x35e864d9 pc: 0x35e85f30
cpsr: 0x200f0010
Binary images description not available

Related

PC register changes supplied value

I'm new to buffer overflows and although I believe I get the process, I feel that something is wrong here. I am studying from a book about exploitation and in the example, there is a simple buffer overflow on a 16 bytes string. This is the code of the binary.
#include <stdio.h>
#include <string.h>
void vuln(){
char buff[16];
scanf("%s",buff);
printf("You entered: %s",buff);
}
void secret(){
printf("My secret is 131313");
}
int main() {
vuln();
return 0;
}
As you can guess, the goal is to call the secret function. I compile it on my Mac using Clang with the following arguments -arch armv7 -fno-stack-protector -fno-pie, so no protection and ARMv7 architecture. It runs normally on the iPhone and when it asks for user input I enter 32 bytes, in groups of four like this AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH. When the application crashes I check on iOS logs and I can see that the crashing happens where the Fs start from.
What I expected to see, is that the pc register will have value 0x46464646 for F, but actually it returns 0x46464644.
These are the values of the registers at the time of crash.
Thread 0 Crashed:
0 ??? 0x46464644 0 + 1179010628
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x0000002d r1: 0x00000000 r2: 0x3ba30f80 r3: 0x00000000
r4: 0x00000000 r5: 0x0000bf71 r6: 0x00000000 r7: 0x45454545
r8: 0x00201854 r9: 0x00000000 r10: 0x00000000 r11: 0x00000000
ip: 0x00012068 sp: 0x00201834 lr: 0x0000bf53 pc: 0x46464644
cpsr: 0x40000010
Also, I tried with just 40 As and it returned 0x41414140. Why it does not return the input entered as expected?
Thank you
In case anyone has the same issue as me, I found out that r15 or pc should always be divided by 4 in ARM. From the official ARM Documentation:
Note that r15 cannot be used with writeback, and that offset must be divisible by 4

IOS App crashes on Iphone

Currently experiencing a problem where the app crashes when you are trying to open it. Any ideas on how to decode the IOS Crash log, i've attached a small section of the crash log below.
Date/Time: 2018-08-28 11:03:06.6413 +0100
Launch Time: 2018-08-28 11:03:05.6498 +0100
OS Version: iPhone OS 11.4.1 (15G77)
Baseband Version: 2.03.12
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 5
Application Specific Information:
abort() called
Filtered syslog:
None found
Last Exception Backtrace:
(0x182512d8c 0x1816cc5ec 0x182512bf8 0x182f0300c 0x18d206adc 0x18d1dfb74 0x18d224c8c 0x18d226978 0x18d240dd0 0x18d24076c 0x182e929b0 0x18d2423d0 0x18d241e7c 0x18d242398 0x18c3edc08 0x102f41034 0x103a8825c 0x103a87c24 0x103a0341c 0x1039f4034 0x103aff8fc 0x103aff938 0x182f5defc 0x182139220 0x182139110 0x182137b10)
Any thoughts on how to determine what the issue is?

Xamarin.iOS app crashes on missing Mono runtime; no suitable image found; code signing blocked mmap

I'm trying to build a Xamarin Forms app with an associated App Extension for iOS. My solution structure is like this:
MyProject
\BitThicket.MyProject -- Forms project
\BitThicket.MyProject.Core -- NET Standard 2.0 class library
\BitThicket.MyProject.iOS -- iOS project
\BitThicket.MyProject.Extensions.Intents -- Intents project
Each project was created from a template, and I've made few changes - and the crash happens at startup, so none of my code is reached anyway.
I'm targeting iOS 11.1, and I have a valid signing certificate and provisioning profile set up. I'm able to build the app and deploy it to a device (my iPhone 7+) from Visual Studio for Mac (7.2.2). However, when the debugger tries to launch the app for me, the blank splash view shows and then the app crashes. The debugger never connects. Incidentally, it crashes in the same way when the app is launched manually on the device.
I retrieved the device logs using Xcode, and the crash looks like this:
Incident Identifier: 948709A2-74AA-4E16-BEEA-072CFCF4AB38
CrashReporter Key: ######################################
Hardware Model: iPhone9,2
Process: BitThicket.Turns.iOS [2457]
Path: /private/var/containers/Bundle/Application/#####-##############-############/BitThicket.Turns.iOS.app/BitThicket.Turns.iOS
Identifier: com.bitthicket.Turns
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.bitthicket.Turns [818]
Date/Time: 2017-11-24 09:41:15.3743 -0600
Launch Time: 2017-11-24 09:41:15.3041 -0600
OS Version: iPhone OS 11.1.2 (15B202)
Baseband Version: 3.21.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: #rpath/Mono.framework/Mono | Referenced from: /var/containers/Bundle/Application/########-####-####-####-############/BitThicket.Turns.iOS.app/BitThicket.Turns.iOS | Reason: no suitable image found. Did find: | /private/var/containers/Bundle/Application/########-####-####-####-############/BitThicket.Turns.iOS.app/Frameworks/Mono.framework/Mono: code signing blocked mmap() of '/private/var/containers/Bundle/Application/########-####-####-####-############/BitThicket.Turns.iOS.app/Frameworks/Mono.framework/Mono'
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 dyld 0x0000000106722f1c __abort_with_payload + 8
1 dyld 0x00000001067226f4 abort_with_payload_wrapper_internal + 100
2 dyld 0x0000000106722720 fcntl + 0
3 dyld 0x00000001066f8498 dyld::fastBindLazySymbol+ 17560 (ImageLoader**, unsigned long) + 0
4 dyld 0x00000001066fb714 dyld::_main+ 30484 (macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 7376
5 dyld 0x00000001066f521c _dyld_start + 68
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000001 x2: 0x000000016d50a470 x3: 0x00000000000000a5
x4: 0x000000016d50a070 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x00000000000002f0
x8: 0x0000000000000020 x9: 0x0000000000000009 x10: 0x6f6e6f4d2f736b72 x11: 0x6f77656d6172662e
x12: 0x726f77656d617246 x13: 0x2e6f6e6f4d2f736b x14: 0x726f77656d617266 x15: 0x00276f6e6f4d2f6b
x16: 0x0000000000000209 x17: 0x000000008000001f x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016d50a070 x21: 0x00000000000000a5 x22: 0x000000016d50a470 x23: 0x0000000000000001
x24: 0x0000000000000006 x25: 0x00000001028f4000 x26: 0x0000000106736000 x27: 0x0000000106735f88
x28: 0x000000016d50ba70 fp: 0x000000016d50a040 lr: 0x00000001067226f4
sp: 0x000000016d50a000 pc: 0x0000000106722f1c cpsr: 0x00000000
Binary Images:
0x1028f4000 - 0x103e43fff BitThicket.Turns.iOS arm64 <###########################> /var/containers/Bundle/Application/########-####-####-####-############/BitThicket.Turns.iOS.app/BitThicket.Turns.iOS
0x1066f4000 - 0x106733fff dyld arm64 <##########################> /usr/lib/dyld
EOF
Does anyone know what causes this? There don't seem to be a lot of direct answers on the Xamarin forums or other places (including SO, unfortunately). I've tried some of the simple things, like restarting Visual Studio for Mac, or delete the app from my device and clean/rebuild the solution, but those things don't seem to help.
In the termination description it sounds like it tried to load mono, but mmap was blocked by code signing somehow - but I don't really understand how. The app builds and deploys to my device, so it seems like code signing is working.
After digging a little further, I found a few examples of problems that seemed similar, and the most common approach factor seemed to be that signing certificates were incorrectly configured. I'm still curious about the underlying reason - the "why" behind the why.
In the end, I found that I had the "Apple Worldwide Developer Relations Certificate Authority" on both the "System" and "login" keychains, as well as configured for "Always Trust", when it should have been only in my "login" keychain and configured for "System Defaults".
Once I corrected those issues, I tried again and I still had the problem. It finally went away after rebooting my mac.

Watch 2 Language Specific Issue

I'm working on a watch App. The Xcode version is 7.3, Swift 2 , iPhone 5 and watch version 3.1.3
First thing Mobile app and watch App both works properly on simulator.The App has two version (English/ Chinese). Now the problem is When I select the english Language for watch, App Works as I needed. But if I change the watch Language to Chinese or any other language then the App Shows a Spinner for long time and then return a black screen. Is anyone facing Same Issue??Please suggest me what is wrong with this app?? Thanks in advance.
Incident Identifier: 9611567E-C66A-4016-A07D-464B0D0F46CB
CrashReporter Key: f90545bedbe3c3364591ded5495f1209af31a874
Hardware Model: Watch2,4
Process: iCE Angel ID WatchApp [276]
Path: /private/var/containers/Bundle/Application/5DC3CFAC-91A8-475D-8B36-60D5353F38E3/iCE Angel ID WatchApp.app/iCE Angel ID WatchApp
Identifier: com.iceangelid.app.watchkit
Version: 1.1.1 (1.1.1)
Code Type: ARM (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: com.iceangelid.app.watchkit [343]
Date/Time: 2017-10-25 15:26:48.9193 +0530
Launch Time: 2017-10-25 15:25:56.0000 +0530
OS Version: Watch OS 3.1.3 (14S960)
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1f1896e0 0x1f185000 + 18144
1 libsystem_kernel.dylib 0x1f1894ac 0x1f185000 + 17580
2 CoreFoundation 0x1f516818 0x1f45d000 + 759832
3 CoreFoundation 0x1f514adc 0x1f45d000 + 752348
4 CoreFoundation 0x1f469414 0x1f45d000 + 50196
5 GraphicsServices 0x20c04e1e 0x20bf9000 + 48670
6 UIKit 0x23ea20be 0x23e2d000 + 479422
7 UIKit 0x23e9cf08 0x23e2d000 + 458504
8 SockPuppetGizmo 0x2a4d0ace 0x2a4c9000 + 31438
9 libdyld.dylib 0x1f0ac566 0x1f0a9000 + 13670
Thread 16:
0 libsystem_pthread.dylib 0x1f25d1a0 0x1f259000 + 16800
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x10004005 r1: 0x07000806 r2: 0x00000000 r3: 0x00000c00
r4: 0x00001b03 r5: 0xffffffff r6: 0x00000000 r7: 0x002b6e08
r8: 0x14e5dd88 r9: 0x014dccdc r10: 0x07000806 r11: 0x07000806
ip: 0xffffffe1 sp: 0x002b6dc0 lr: 0x1f1894ad pc: 0x1f1896e0
cpsr: 0x60000010
Binary Images:
0x100000 - 0x103fff iCE Angel ID WatchApp armv7k <7c65269026583b9eb4c246f5eb0d09ce> /var/containers/Bundle/Application/5DC3CFAC-91A8-475D-8B36-60D5353F38E3/iCE Angel ID WatchApp.app/iCE Angel ID WatchApp
0x140000 - 0x16ffff dyld armv7k <40c16d46fa443776b664db9a54fcd325> /usr/lib/dyld
0x1eb9c000 - 0x1eb9ffff libSystem.B.dylib armv7k <acc06d05ed6537c2a5f58cf93c84188b> /usr/lib/libSystem.B.dylib
0x1eba0000 - 0x1ebe3fff libc++.1.dylib armv7k <97e755cc71ae3b86b896f3ac8408fe1a> /usr/lib/libc++.1.dylib
0x1ebe4000 - 0x1ebfffff libc++abi.dylib armv7k <10a460aa3dbc3a2e929eea18e8e9f2a3> /usr/lib/libc++abi.dylib
[https://i.stack.imgur.com/Sr7m9.png][1]
One more thing that i forgot to mention is the app works properly on real devices when installed first time but if I uninstall the app and then reinstall it this produce the same issue as mentioned above.

How to understand EXC_BAC_ACCESS (SIGSEGV) KERN_INVALID_ADDRESS log?

I'm doing an app in Titanium for Android and IOS. When I navigate a lot in the application I have a random exception and the app crashes.
How can I know where is the problem?
The app is a little complex to explain:
It has two windows, first window is for "home" view that is only in portrait mode, and when I click to go to another view, I close the first window, I open another window and I add a view with the content to this window. The content view load the same web view with different url.
The app loads ok and I can navigate for the different views and windows ok. But when I navigate a lot, finally I have a EXC_BAC_ACCESS (SIGSEGV) and KERN_INVALID_ADDRESS
This only happens on device (on simulator it works ok) with iPad os 5.1.1 and os 7.0.2.
This is the log where the thread crashes:
Incident Identifier: 1A3E94A0-E6FC-4BFF-BB3B-7651D66664DE
CrashReporter Key: d4422d11c83ca9acf2212996b20dd1078f00f36c
Hardware Model: iPad3,3
Process: Appname [16747]
Path: /var/mobile/Applications/1BACB160-AED8-4F5F-A599-4F7F1F4A4DC4/Appname.app/Appname
Identifier: Appname
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-10-31 11:56:58.680 +0100
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libicucore.A.dylib 0x37953fb2 utext_setNativeIndex + 122
1 libicucore.A.dylib 0x379542a6 icu::RuleBasedBreakIterator::following(int) + 246
2 WebKit 0x35f20b2c -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:drawUnderline:] + 2176
3 WebKit 0x35e99078 -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:] + 108
4 WebKit 0x35e98ffc -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:] + 100
5 WebKit 0x35e98f88 -[NSString(WebStringDrawing) _web_drawInRect:withFont:ellipsis:alignment:lineSpacing:includeEmoji:truncationRect:measureOnly:] + 100
6 WebKit 0x35e98f14 -[NSString(WebStringDrawing) _web_sizeInRect:withFont:ellipsis:lineSpacing:] + 80
7 UIKit 0x34fba65c -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:lineSpacing:] + 108
8 UIKit 0x3512ee0e -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:] + 46
9 Appname 0x0014528c -[TiUILabel sizeForFont:] (TiUILabel.m:57)
10 Appname 0x0014537a -[TiUILabel contentWidthForWidth:] (TiUILabel.m:69)
11 Appname 0x001449bc -[TiUILabelProxy contentWidthForWidth:] (TiUILabelProxy.m:17)
12 Appname 0x00116fb4 -[TiViewProxy autoWidthForSize:] (TiViewProxy.m:756)
13 Appname 0x00120dbc -[TiViewProxy computeChildSandbox:withBounds:] (TiViewProxy.m:2543)
14 Appname 0x0011fbb8 -[TiViewProxy measureChildren:] (TiViewProxy.m:2352)
15 Appname 0x00121e36 -[TiViewProxy layoutChildren:] (TiViewProxy.m:2818)
16 Appname 0x0011dd9a -[TiViewProxy refreshView:] (TiViewProxy.m:2061)
17 Appname 0x0011f25c -[TiViewProxy layoutChildrenIfNeeded] (TiViewProxy.m:2264)
18 Appname 0x001d5ba0 +[TiLayoutQueue layoutProxy:] (TiLayoutQueue.m:79)
19 Appname 0x001d59b0 performLayoutRefresh (TiLayoutQueue.m:46)
20 CoreFoundation 0x32a5fa2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
21 CoreFoundation 0x32a5f692 __CFRunLoopDoTimer + 358
22 CoreFoundation 0x32a5e268 __CFRunLoopRun + 1200
23 CoreFoundation 0x329e149e CFRunLoopRunSpecific + 294
24 CoreFoundation 0x329e1366 CFRunLoopRunInMode + 98
25 GraphicsServices 0x32b2e432 GSEventRunModal + 130
26 UIKit 0x34fc0cce UIApplicationMain + 1074
27 Appname 0x000b8c34 main (main.m:36)
28 Appname 0x000b8470 ___lldb_unnamed_function1$$Appname + 32
Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x00000000
r4: 0x0d65c6b0 r5: 0x0d65c690 r6: 0x00000000 r7: 0x2feabfac
r8: 0x00000003 r9: 0x2feabf6c r10: 0x00000003 r11: 0x08052950
ip: 0x00000000 sp: 0x2feabfa4 lr: 0x00000000 pc: 0x37953fb2
cpsr: 0x80000030
I've also had the log of other threads and information about Binary Images. If it's useful I can paste it.
How can I know what is the cause of the problem and where is the problem?
Thank you very much
You get EXC_BAC_ACCESS because you are trying to access object which was removed from memory. It happens only on device when you navigate to many windows because every window takes some part of memory and when there is no more space for new windows iOS clears old objects who were deleted by you previously.
You can replicate this issue on simulator by forcing Memory Warning pressing ⇧ + ⌘ + M.
To solve your issue you have to store variable pointing to window object which you want to reopen later in some global dictionary.
Finally, I think it was a problem with webview component. I created a web view in each view (I need it to show some graphs) and when I return to home view, I tried to remove it. I think the problem is that you can't remove it completely and it takes a lot of memory.
Finally I solved it creating a webview in app.js and using it in all views changing the url and dimensions.

Resources