Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

[iOS] SDK 51.2.1 - crash during startup

Open udmv opened this issue 5 months ago • 16 comments

Problem Description

AIR SDK: 51.2.1.5 (or any from 51.2.1.1 to 51.2.1.5) Test environment: iPhone 14 Pro iOS 18.4.1, iPhone 14 iOS 17.4.1 Dev environment: macOS 15.5, XCode 16.2, IntelliJ, JDK 17

Reproducible everytime running the result IPA on a device. The crashlog is retrieved from a tested device

Steps to Reproduce

Steps:

  1. Have an ANE with dynamic framework inside
  2. Include the ANE to the project, put the dynamic framework into IPA_root/Frameworks folder
  3. Package the IPA and run on a iOS device
  4. App crashes right at the startup

Note: Able to reproduce with several dynamic frameworks like Didomi-XCFramework or HelpshiftX. Both are written on Swift.

platform.xml inside ANE iOS part:

<platform xmlns="http://ns.adobe.com/air/extension/22.0">
  <sdkVersion>12.0</sdkVersion>

    <linkerOptions>
      <option>-rpath @executable_path/Frameworks</option>
    </linkerOptions>
    
    <packagedDependencies>
      <packagedDependency>Didomi.framework</packagedDependency>
   </packagedDependencies>
</platform>

Known Workarounds

Use the previous AIR SDK release 51.1, like 51.1.3.10

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4370169856
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT (graphics)        1047b8000-1063d0000 [ 28.1M] r-x/r-x SM=COW  /var/containers/Bundle/Application/BBFAFCA8-A6CC-49CA-B5B8-1CD98E203509/EmpireFourKingdoms.app/EmpireFourKingdoms
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [3000]

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   EmpireFourKingdoms            	       0x104d1ccf0 0x104cf8000 + 150768
1   EmpireFourKingdoms            	       0x104d1362c 0x104cf8000 + 112172
2   EmpireFourKingdoms            	       0x104df7ef8 0x104cf8000 + 1048312
3   EmpireFourKingdoms            	       0x104df8514 0x104cf8000 + 1049876
4   EmpireFourKingdoms            	       0x104d1d688 0x104cf8000 + 153224
5   EmpireFourKingdoms            	       0x104d1d824 0x104cf8000 + 153636
6   EmpireFourKingdoms            	       0x104d1de00 0x104cf8000 + 155136
7   Foundation                    	       0x196b75e08 __NSFireDelayedPerform + 371
8   CoreFoundation                	       0x197e7b654 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 31
9   CoreFoundation                	       0x197e7b314 __CFRunLoopDoTimer + 979
10  CoreFoundation                	       0x197e7ae8c __CFRunLoopDoTimers + 287
11  CoreFoundation                	       0x197e5802c __CFRunLoopRun + 1847
12  CoreFoundation                	       0x197e7c700 CFRunLoopRunSpecific + 571
13  GraphicsServices              	       0x1e49bd190 GSEventRunModal + 167
14  UIKitCore                     	       0x19aa9a240 -[UIApplication _run] + 815
15  UIKitCore                     	       0x19aa98470 UIApplicationMain + 335
16  EmpireFourKingdoms            	       0x104e0014c main + 68
17  dyld                          	       0x1be87fad8 start + 5963

crashlog.zip

udmv avatar Jun 16 '25 15:06 udmv

Hi

If using 51.2, could you please update your ~/.airsdk/adt.cfg file to include a line such as

IPASymbolFile=ipasyms.bin

and then re-generate the IPA file and install it. Then you should see a file called ipasyms.bin alongside the IPA, and if you could send us that along with the crash log IPS file, we should be able to see what's going on here..

thanks

ajwfrost avatar Jun 16 '25 16:06 ajwfrost

.... or the other option, I could look in your zip and realise you built ipa-debug ... so actually, leave that with us, we should be able to work it out from here!

thanks

ajwfrost avatar Jun 16 '25 16:06 ajwfrost

It looks like something's gone wrong within the packaging .. would it be possible to get hold of your IPA file so that we can analyse the issue? An upload link is: https://transfer.harman.com/requests/4lhjRzs15Am8m1lNBczFX1

thanks

ajwfrost avatar Jun 16 '25 16:06 ajwfrost

Thanks for the IPA file. Can I check, do you have a workflow that modifies the SWF file after you've created the IPA file? Because this doesn't appear to be the IPA as initially built from ADT - at least, if it is, something is going wrong within ADT itself..

ajwfrost avatar Jun 17 '25 05:06 ajwfrost

@ajwfrost No modifications happen after the adt command creates the IPA file. And the same crash happens not only in our game project, but also from a test app project by running iOS Debug configuration in IDEA IntelliJ

udmv avatar Jun 17 '25 08:06 udmv

If they are swift based dependencies have you tried including the swift flags in your platform xml eg:

<option>-lSwiftCompat</option>
<option>-lswiftFoundation</option>
<option>-rpath /usr/lib/swift</option>

marchbold avatar Jun 17 '25 08:06 marchbold

@marchbold with such options I am getting compile errors

Undefined symbols for architecture arm64:
  "__swift_stdlib_operatingSystemVersion", referenced from:
      __ZL27_initializeVouchersDisabledPv in libSwiftCompat.a[arm64][10](Actor.cpp.o)
  "_swift_errorRetain", referenced from:
      __ZN5swift47swift56override_swift_task_future_wait_throwingEPNS_11OpaqueValueEPNS_12AsyncContextEPNS_9AsyncTaskEPU14swiftasynccallFvU19swift_async_contextS3_U13swift_contextPvES3_PU14swiftasynccallFvS1_U19swift_async_contextS3_S5_S8_S3_E in libSwiftCompat.a[arm64][9](Task.cpp.o)
  "_swift_once", referenced from:
      __ZN5swift18restoreTaskVoucherEPNS_9AsyncTaskE in libSwiftCompat.a[arm64][10](Actor.cpp.o)
      __ZN5swift14VoucherManager9swapToJobEPNS_3JobE in libSwiftCompat.a[arm64][10](Actor.cpp.o)
ld: symbol(s) not found for architecture arm64

Compilation failed while executing : ld64

udmv avatar Jun 17 '25 08:06 udmv

The issue seems to be in the package protection feature i.e. to try to ensure that the IPA file was generated by ADT and hadn't been hacked apart and re-created by a third party.. from what I can see, there's something wrong with the SWF file; we can't recreate this scenario here though. You mention it also fails in a test app, does that have any ANEs or is it just a blank project? Were you using IntelliJ earlier for the packaging too? (Actually it looks like you were, given the details you helpfully provided in your original post!) - we'll try checking this with IntelliJ here to see if they're doing something odd.

In the meantime, to validate what I think the issue is, can you please edit your ~/.airsdk/adt.cfg file and add a line PackageValidation=never and then re-create the IPA?

thanks

ajwfrost avatar Jun 17 '25 08:06 ajwfrost

@ajwfrost same crash with PackageValidation=never option.

The test project contains only one AS3 class and a single ANE (in my case, the Didomi framework). IntelliJ is used for both the main project and the test project. In addition to the IntelliJ debug configuration, maven is used for compilation and packaging. However, the result remains the same regardless of how I compile or package the resulting IPA. The only changes that seem to make a difference are either removing the ANE or using an older version of Adobe AIR.

Would it help if I sent you the adt_log file or the test project along with the ANE?

udmv avatar Jun 17 '25 09:06 udmv

Hi - I should have set up that upload link for multi-use .. have done that with the below one, so, yes please, if you can send us the project and the log file, it may help. https://transfer.harman.com/requests/83ziGY2MyB5KNX5I49GCOB

Just to confirm - do you have a commercial license for the AIR SDK, as the license file that's present in your app is saying that you don't. The app then appears to be crashing when trying to display the splash screen (which of course, it should only display if there's no developer ID/license).

It actually seems to be lacking the Assets.car file .. which should be being packaged automatically by ADT, assuming you don't have a license. The log may help us understand what's going on here, it seems odd that the presence of an ANE might impact things in this way... definitely need to work out why it's not packaging properly!

thanks

ajwfrost avatar Jun 17 '25 14:06 ajwfrost

@ajwfrost yes, I have the commercial license, but it's used only for the production release builds, not test. I removed the projects Assets.car for this test app. But in the main project it exists inside IPA. And the crash persists no matter if I include or exclude it. I also have sent you the test project files via the upload link.

udmv avatar Jun 17 '25 15:06 udmv

Thanks @udmv - I've updated your app ID to one that matches our provisioning profile and signed this with our certificate - and then got a failure in installation, because of the provisioning profile capabilities. If I take out your entitlements, then I get the application starting up and running fine...

Could you try an ipa-debug build, with your development certificates, and make sure the entitlements are set up for that (I can never remember the appropriate get-task-allow setting etc..) - and if that crashes, could we get the IPS file for it please?

Given you get a crash with the ANE but not without the ANE, is your test app actually doing anything with the ANE itself? If not, could you perhaps use <extensionID delayLoad="true"> in the app descriptor to see if that gets it any further?

thanks

ajwfrost avatar Jun 17 '25 17:06 ajwfrost

@ajwfrost I've found what's causing the crash. After you mentioned Assets.car and hinted that the app crashes when trying to display the splash screen, I noticed that the framework (in this case, Didomi.framework) contains its own Assets.car file. After removing that car file, the game stops crashing!

So, the state where there is no Assets.car present inside the IPA allows the app to run fine. That also explains why there was no crash after I removed the ANE and the framework from the package. Additionally, after removing the Assets.car from the framework but adding back the project-related one (which contains our game’s app icons), the app still crashes.

So, how can we work around this issue now, since we need that file in the root of the IPA to display the app icons?

udmv avatar Jun 18 '25 08:06 udmv

So just to check: if you have no Assets.car file at all, then it doesn't crash? But if you have your own root Assets.car, or the framework's Assets.car, or both, then it crashes?

When you say it crashes, is that also happening when you do a build on a machine where you have an AIR SDK license file i.e. avoiding the attempt to display the splash screen? I'm wondering if there's an issue because of it not finding the required assets for the splash images - i.e. per the release notes:

The splash screen is implemented as a launch storyboard with the binary storyboard and related assets included in the SDK. This has implications for those who are providing their own storyboards or images in an Assets.car file:

  • If you are on the ‘free tier’ then the AIR developer tool will ignore any launch storyboard you have specified within your application descriptor file, or provided within the file set for packaging into the IPA file.
  • If you are creating an Assets.car file, then you need to add in the AIR splash images from the SDK which are in the “lib/aot/res” folder. These should be copied and pasted into your “.xcassets” folder in the Xcode project that you are using for creation of your assets.

I assume the ideal though would be for both Assets.car files to be present. If you can get to a point where it works with just your root one, it would then be good to check if the re-introduction of the framework's assets file causes any issue..

thanks

ajwfrost avatar Jun 18 '25 10:06 ajwfrost

@ajwfrost

So just to check: if you have no Assets.car file at all, then it doesn't crash? But if you have your own root Assets.car, or the framework's Assets.car, or both, then it crashes?

Yes, regarding the test we discussed before.

Now after checking everything again, here's the current situation: My own root Assets.car file did not include the AIR splash images from the SDK (located in the lib/aot/res folder). After adding them, the app no longer crashes—regardless of whether the framework’s Assets.car file is present or not. This applies to both the “free tier” setup and when the AIR SDK license is installed on the build machine.

However, one issue still remains: If you’re using the free tier and the root Assets.car is either missing or doesn’t contain the AIR splash images, but the framework does contain an Assets.car, then the app crashes. It seems that in this case, ADT doesn’t automatically package the AIR splash screen Assets.car, which might be conflicting with the one from the framework? That’s just my assumption based on how ADT and AIR seem to work internally. A quick fix would be to remove the Assets.car file from the framework.

udmv avatar Jun 18 '25 15:06 udmv

Great - thanks for checking all that. So, yes, it looks like where we normally would pull in our default Assets.car file, we're getting confused by the presence of the Assets.car from that framework, and failing to do this. i.e. bad string matching...

We can update the packager to try to eliminate this issue; the other task that we have in the backlog is to display error messages where we end up with situations like this, so that it's easier to work out what's happening and why!

Thanks

ajwfrost avatar Jun 18 '25 15:06 ajwfrost

@ajwfrost I've found what's causing the crash. After you mentioned Assets.car and hinted that the app crashes when trying to display the splash screen, I noticed that the framework (in this case, Didomi.framework) contains its own Assets.car file. After removing that car file, the game stops crashing!

So, the state where there is no Assets.car present inside the IPA allows the app to run fine. That also explains why there was no crash after I removed the ANE and the framework from the package. Additionally, after removing the Assets.car from the framework but adding back the project-related one (which contains our game’s app icons), the app still crashes.

So, how can we work around this issue now, since we need that file in the root of the IPA to display the app icons?

You just saved me after a week of struggle. Thank you so much!

flashmandv avatar Nov 08 '25 07:11 flashmandv