I'm having an issue with an iOS regarding inAppPurchases. The app is developed in Delphi/Firemonkey and it's been in beta (on TestFlight) for over a year now.
Everything was working fine in TestFlight (including the inAppPurchase) so I pushed it to the app store. Once live, I tested the inAppPurchase again (which is a 79p/month subscription). The app crashed and then would not open again.
Uninstalling/Rebooting/Installing didn't work. The only fix was to factory reset my device. Luckily, I have a flag which get's returned at login to specify whether the user is "subscribed" so, for now, I've set them all to "subscribed=T" as I can't go telling my customers they need to factory reset their phones - that would be really uncool.
Note: This only happens in the Live version from the AppStore, installing from TestFlight works fine. Also, it only happens once the user has tried to subscribe/restore their subscription.
I'm hoping someone has more of an idea about iOS/XCode logs and can point me in the right direction. I've pasted 2 logs below, one from the iOS device, and the other from XCode console.
If anyone can give any information about what is happening here it would be much appreciated.
Here's the XCode Console Log
https://www.dropbox.com/s/39nkcbvg0tiix44/console_log.txt?dl=0
Here is the log from the device
{"app_name":"iFire","timestamp":"2020-06-08 14:33:11.00 +0100","app_version":"3.2","slice_uuid":"dccce1e5-fbb2-3add-bcd1-3ea85d6b81c4","adam_id":1171368453,"build_version":"3.2.4314","bundleID":"com.kernowsoftware.ifire","share_with_app_devs":0,"is_first_party":0,"bug_type":"109","os_version":"iPhone OS 13.5.1 (17F80)","incident_id":"FAD3077C-ED29-41AB-B719-B042F5D879F3","name":"iFire"}
Incident Identifier: FAD3077C-ED29-41AB-B719-B042F5D879F3
CrashReporter Key: 69ad7719238a353771aa1d858abdc45395bc026c
Hardware Model: iPhone11,8
Process: iFire [617]
Path: /private/var/containers/Bundle/Application/9D0C42A8-0498-45F9-8B0F-C83F8A0DCF10/iFire.app/iFire
Identifier: com.kernowsoftware.ifire
Version: 3.2.4314 (3.2)
AppStoreTools: 11E608a
AppVariant: 1:iPhone11,8:13
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.kernowsoftware.ifire [606]
Date/Time: 2020-06-08 14:33:11.3492 +0100
Launch Time: 2020-06-08 14:33:10.8981 +0100
OS Version: iPhone OS 13.5.1 (17F80)
Release Type: User
Baseband Version: 2.06.00
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000193556df0 0x193530000 + 159216
1 libsystem_pthread.dylib 0x0000000193476930 0x193474000 + 10544
2 libsystem_c.dylib 0x0000000193404ba4 0x19338e000 + 486308
3 libc++abi.dylib 0x0000000193529f40 0x19351a000 + 65344
4 libc++abi.dylib 0x000000019351b818 0x19351a000 + 6168
5 libc++abi.dylib 0x00000001935293cc 0x19351a000 + 62412
6 libc++abi.dylib 0x0000000193529368 0x19351a000 + 62312
7 libdispatch.dylib 0x0000000193410350 0x19340d000 + 13136
8 libdispatch.dylib 0x000000019341c600 0x19340d000 + 62976
9 CoreFoundation 0x00000001936eb6b0 0x19363e000 + 710320
10 CoreFoundation 0x00000001936e62c8 0x19363e000 + 688840
11 CoreFoundation 0x00000001936e58f4 0x19363e000 + 686324
12 GraphicsServices 0x000000019dafc604 0x19daf9000 + 13828
13 UIKitCore 0x00000001978b9358 0x196e4a000 + 10941272
14 iFire 0x00000001004c74b4 0x100014000 + 4928692
15 iFire 0x000000010057ed28 0x100014000 + 5680424
16 iFire 0x0000000100f1e2a8 0x100014000 + 15770280
17 libdyld.dylib 0x00000001935612dc 0x193560000 + 4828
Thread 1:
0 libsystem_pthread.dylib 0x000000019347d9c0 0x193474000 + 39360
Thread 2:
0 libsystem_pthread.dylib 0x000000019347d9c0 0x193474000 + 39360
Thread 3 name: Dispatch queue: BSXPCCnx:com.apple.frontboard.systemappservices (BSCnx:client:com.apple.frontboard.workspace-service)
Thread 3:
0 CoreFoundation 0x00000001937d6694 0x19363e000 + 1672852
1 CoreFoundation 0x000000019370cb30 0x19363e000 + 846640
2 BaseBoard 0x00000001963b24c4 0x196349000 + 431300
3 BaseBoard 0x00000001963b0310 0x196349000 + 422672
4 BoardServices 0x00000001986ee85c 0x1986e9000 + 22620
5 BoardServices 0x00000001986eca58 0x1986e9000 + 14936
6 BoardServices 0x00000001986ebb5c 0x1986e9000 + 11100
7 BoardServices 0x00000001986f350c 0x1986e9000 + 42252
8 BoardServices 0x0000000198709f0c 0x1986e9000 + 134924
9 BoardServices 0x00000001986f3320 0x1986e9000 + 41760
10 BoardServices 0x00000001987086ac 0x1986e9000 + 128684
11 libdispatch.dylib 0x000000019340eec4 0x19340d000 + 7876
12 libdispatch.dylib 0x000000019341033c 0x19340d000 + 13116
13 libdispatch.dylib 0x000000019341685c 0x19340d000 + 39004
14 libdispatch.dylib 0x00000001934172c4 0x19340d000 + 41668
15 libdispatch.dylib 0x000000019341672c 0x19340d000 + 38700
16 libdispatch.dylib 0x00000001934172c4 0x19340d000 + 41668
17 libdispatch.dylib 0x0000000193420928 0x19340d000 + 80168
18 libsystem_pthread.dylib 0x0000000193477714 0x193474000 + 14100
19 libsystem_pthread.dylib 0x000000019347d9c8 0x193474000 + 39368
Thread 4:
0 libsystem_pthread.dylib 0x000000019347d9c0 0x193474000 + 39360
Thread 5:
0 libsystem_kernel.dylib 0x0000000193534784 0x193530000 + 18308
1 libsystem_kernel.dylib 0x0000000193533ba8 0x193530000 + 15272
2 iFire 0x000000010003c26c 0x100014000 + 164460
3 libsystem_pthread.dylib 0x00000001934758fc 0x193474000 + 6396
4 libsystem_pthread.dylib 0x000000019347d9d4 0x193474000 + 39380
Thread 6:
0 libsystem_pthread.dylib 0x000000019347d9c0 0x193474000 + 39360
Thread 7 name: com.apple.uikit.eventfetch-thread
Thread 7:
0 libsystem_kernel.dylib 0x0000000193534784 0x193530000 + 18308
1 libsystem_kernel.dylib 0x0000000193533ba8 0x193530000 + 15272
2 CoreFoundation 0x00000001936eb314 0x19363e000 + 709396
3 CoreFoundation 0x00000001936e60a0 0x19363e000 + 688288
4 CoreFoundation 0x00000001936e58f4 0x19363e000 + 686324
5 Foundation 0x0000000193a2eb18 0x193a27000 + 31512
6 Foundation 0x0000000193a2e9f0 0x193a27000 + 31216
7 UIKitCore 0x000000019795f840 0x196e4a000 + 11622464
8 Foundation 0x0000000193b68c10 0x193a27000 + 1317904
9 libsystem_pthread.dylib 0x00000001934758fc 0x193474000 + 6396
10 libsystem_pthread.dylib 0x000000019347d9d4 0x193474000 + 39380
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x000000016fdea050 x5: 0x000000016fdea600 x6: 0x000000000000006e x7: 0x0000000000000000
x8: 0x00000000000005b9 x9: 0x183250979d74ca51 x10: 0x0000000000000001 x11: 0x0000000000000002
x12: 0x0000000000000000 x13: 0x00000000000007fb x14: 0x0000000000000010 x15: 0x0000000000000000
x16: 0x0000000000000148 x17: 0x00000001d54f6808 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000000000407 x21: 0x0000000102f01960 x22: 0x0000000000000000 x23: 0x0000000000000000
x24: 0x0000000002ffffff x25: 0x0000000102f01960 x26: 0x00000000000020ff x27: 0x0000000000000114
x28: 0x0000000281a92900 fp: 0x000000016fdea560 lr: 0x0000000193476930
sp: 0x000000016fdea540 pc: 0x0000000193556df0 cpsr: 0x40000000
esr: 0x56000080 Address size fault
Thanks in advance! Graham
I had this exact problem and discovered it was a recognised but un-documented flaw in iOS for subscription based in app purchases. The problem is, when using subscriptions, the Storekit framework within the app will check the users account really early in the load process, but it has to happen before the iAP mechanism is initialised within Firemonkey or it may randomly crash your app on load due to a sequencing issue.
The fix I implemented was to postpone the initialisation call within the iAP sources of Firemonkey until later as described below:
Copy FMX.InAppPurchase.pas and FMX.InAppPurchase.iOS.pas into your project so you can make the following changes.
In the initialisation section of FMX.InAppPurchase.pas, comment out the "RegisterInAppPurchaseService" call. This is the one that happens too early.
In my code I also wrapped the entire block of code within this section in a try...except to swallow and log any errors.
Make the RegisterInAppPurchaseService call in the TCustomInAppPurchase.Create() method instead:
constructor TCustomInAppPurchase.Create(AOwner: TComponent); var IAPIntf: IInterface; begin inherited;
//Call the service registration here to fix the problem. //Protected call to ensure it only happens once if not iAPRegistered then RegisterInAppPurchaseService;
FProductIDs:= TStringList.Create; if TPlatformServices.Current.SupportsPlatformService(IFMXInAppPurchaseService, IAPIntf) then begin FInAppPurchaseService:= IFMXInAppPurchaseService(IAPIntf); FInAppPurchaseService.AddComponent(Self); end; end;
I added a control variable defined as class var in TCustomInAppPurchase for iAPRegistered to make sure it only ever initialises once. Calling multiple times may cause additional problems.
In InAppPurchase.iOS.pas, within RegisterInAppPurchaseService, add a line setting iAPRegistered:=True;
The above solved the crashing for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.