Mac App Store application fails to open child app (crashing in sanbox init) - how can I package a secondary app within my master app for MAS?

I have an app that is packaged for the Mac App Store. It runs great but now I need to package a second app along with it as a supplementary .app.

I have constructed a test case with the smallest possible child app. All it does is open a window that says "success".

When I archive and distribute through TestFlight the child app crashes on startup.

I'm attaching the crash report below, but first, this is how I'm starting the child app from swift:


        let url = Bundle.main.bundleURL.path + "/Contents/Plugins/Child.app/Contents/MacOS/Child"

        process.executableURL = URL(fileURLWithPath:url)

        process.terminationHandler = { (process) in

           print("\ndidFinish: \(!process.isRunning)")

        }

        do {

          try process.run()

        } catch let error as NSError {

            NSLog("Failed to execute %@", error.description)

        }

The Child.app is being copied to the Plugins folder as part of the Xcode solution.

Attached is the crash report, here's a brief summary:




Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)

Exception Codes:       0x0000000000000001, 0x0000000000000000

Exception Note:        EXC_CORPSE_NOTIFY



Termination Reason:    Namespace SIGNAL, Code 4 Illegal instruction: 4

Terminating Process:   exc handler [52231]



Application Specific Signatures:

SYSCALL_SET_PROFILE



Thread 0 Crashed::  Dispatch queue: com.apple.main-thread

0   libsystem_secinit.dylib                 0x7ff810c4b337 _libsecinit_appsandbox.cold.5 + 79

1   libsystem_secinit.dylib                 0x7ff810c4a82f _libsecinit_appsandbox + 2221

2   libsystem_trace.dylib                   0x7ff805be1848 _os_activity_initiate_impl + 51

3   libsystem_secinit.dylib                 0x7ff810c49f41 _libsecinit_initializer + 67

4   libSystem.B.dylib                       0x7ff810c5d8c5 libSystem_initializer + 286

5   dyld                                       0x1180b6d2b invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 182

6   dyld                                       0x1180dd237 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 242

7   dyld                                       0x1180d483a invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 557

8   dyld                                       0x1180a3db3 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 129

9   dyld                                       0x1180d45cb dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 179

10  dyld                                       0x1180dcd8e dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 466

11  dyld                                       0x1180b6c5e dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144

12  dyld                                       0x1180bd1aa dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 30

13  dyld                                       0x1180ca3de dyld4::APIs::runAllInitializersForMain() + 38

14  dyld                                       0x1180a837d dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3443

15  dyld                                       0x1180a74d4 start + 388

Answered by DTS Engineer in 720691022

how can I package a secondary app within my [main] app for MAS?

This issue is covered by my suite of Resolving Trusted Execution Problems posts, and specifically Resolving App Sandbox Inheritance Problems.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

how can I package a secondary app within my [main] app for MAS?

This issue is covered by my suite of Resolving Trusted Execution Problems posts, and specifically Resolving App Sandbox Inheritance Problems.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Mac App Store application fails to open child app (crashing in sanbox init) - how can I package a secondary app within my master app for MAS?
 
 
Q