appspector / ios-sdk

AppSpector is a debugging service for mobile apps
https://appspector.com
Other
70 stars 5 forks source link

iOS 18 SQLite crash #31

Closed willk37 closed 1 month ago

willk37 commented 2 months ago

My team and I are running into some issues when trying to get our apps ready for iOS 18. There seems to be some unexpected behavior going on related to the AppSpector iOS SDK. We're seeing crashes related to SQLite when we try to launch the app. We're also seeing multiple console messages related to SQLite classes having multiple implementations. These issues are only reproducible when including the AppSpector SDK in our apps, removing the SDK allows the apps to launch normally and removes the console messages.

Environment

Xcode 16.0 Beta 6 (16A5230g) iOS 18.0-beta7 Simulator AppSpector 1.4.12

Example Crashes

AppSpectorSDK`fake_sqlite3_open_v2:
->  0x106e2b204 <+0>:  stp    x20, x19, [sp, #-0x20]!
    0x106e2b208 <+4>:  stp    x29, x30, [sp, #0x10]
    0x106e2b20c <+8>:  add    x29, sp, #0x10
    0x106e2b210 <+12>: mov    x19, x1
    0x106e2b214 <+16>: adrp   x8, 299
    0x106e2b218 <+20>: ldr    x8, [x8, #0xda8]
    0x106e2b21c <+24>: blr    x8
    0x106e2b220 <+28>: mov    x20, x0
    0x106e2b224 <+32>: ldr    x0, [x19]
    0x106e2b228 <+36>: adrp   x2, 0
    0x106e2b22c <+40>: add    x2, x2, #0xec             ; trace_callback
    0x106e2b230 <+44>: mov    w1, #0x2                  ; =2 
    0x106e2b234 <+48>: mov    x3, #0x0                  ; =0 
    0x106e2b238 <+52>: bl     0x106ebc090               ; symbol stub for: sqlite3_trace_v2
    0x106e2b23c <+56>: mov    x0, x20
    0x106e2b240 <+60>: ldp    x29, x30, [sp, #0x10]
    0x106e2b244 <+64>: ldp    x20, x19, [sp], #0x20
    0x106e2b248 <+68>: ret    
libRPAC.dylib`interposed_sqlite3_open:
->  0x10585b0c4 <+0>:  stp    x22, x21, [sp, #-0x30]!
    0x10585b0c8 <+4>:  stp    x20, x19, [sp, #0x10]
    0x10585b0cc <+8>:  stp    x29, x30, [sp, #0x20]
    0x10585b0d0 <+12>: add    x29, sp, #0x20
    0x10585b0d4 <+16>: mov    x19, x1
    0x10585b0d8 <+20>: mov    x20, x0
    0x10585b0dc <+24>: bl     0x105866174               ; symbol stub for: sqlite3_open
    0x10585b0e0 <+28>: mov    x21, x0
    0x10585b0e4 <+32>: adrp   x3, 21
    0x10585b0e8 <+36>: ldr    x3, [x3, #0x4d8]
    0x10585b0ec <+40>: adrp   x2, 16
    0x10585b0f0 <+44>: add    x2, x2, #0x132            ; "sqlite3_open"
    0x10585b0f4 <+48>: mov    x0, x20
    0x10585b0f8 <+52>: mov    x1, x19
    0x10585b0fc <+56>: bl     0x10585b114               ; sqlite3_open_track_state
    0x10585b100 <+60>: mov    x0, x21
    0x10585b104 <+64>: ldp    x29, x30, [sp, #0x20]
    0x10585b108 <+68>: ldp    x20, x19, [sp, #0x10]
    0x10585b10c <+72>: ldp    x22, x21, [sp], #0x30
    0x10585b110 <+76>: ret    

Example Console Log

objc[1972]: Class _TtC6SQLite6Backup is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_22A5307f/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/LinkServices.framework/LinkServices (0x1ee3e45a0) and ~/Library/Developer/CoreSimulator/Devices/1A49D6F1-9787-42DB-BC1C-2B43658D76E3/data/Containers/Bundle/Application/94101437-99E4-46C8-8852-D915399F0611/BuzzFeed.app/BuzzFeed.debug.dylib (0x10a3f4a70). One of the two will be used. Which one is undefined
deszip commented 2 months ago

Hi @willk37 thanks for trying SDK on beta releases. Appreciate your feedback. We'll take a look at the crash (would be awesome if you can attach a full report).

Regarding duplicate symbol messages looks like you have SQLiteBackup class in your app and same now present in iOS 18 SDK. You can rename yours and messages will go away I guess.

deszip commented 1 month ago

Hi @willk37 , we are still investigating the issue but quick fix is to disable 'Thread Performance Checker' in your app scheme settings. Will keep you updated on fix for this.

Screenshot 2024-09-04 at 19 14 17
deszip commented 1 month ago

Hi @willk37 , issue was fixed in 1.4.13 release.

willk37 commented 1 month ago

Thanks @deszip! Confirming it fixed!