Crash On launch and Errors on iPad

I am attempting to use the latest Solar2D SDK. To make a new build for my App. It seems like I am running into permissions issues.

My last update to this app was back in 2017. Recently customer have been reporting crashes on launch on newer devices running iOS 17+. After contacting Apple they indicated it might be a permissions issue.

After updating / downloading the provisioning assets, I was able to load the app into the latest Corona simulator on my Mac and successfully build and transfer the app to my 6th gen iPad mini running 17.5.1.

When I launch the app it crashes immediately.

I accessed the console by using Xcode to connect to my iPad mini and these are the faults that I found:
Sandbox: AshlyRemote(4839) deny(1) sysctl-read kern.bootargs
Sandbox: AshlyRemote(4839) deny(2) file-test-existence /usr/bin/swift-backtrace
Sandbox: AshlyRemote(4839) deny(2) file-test-existence /usr/bin/arm64e

This app is universal and runs on both iPhone and iPad. It saves and load files from the app file directory and lets users transfer files in and out of the app. It also uses UDP network communication and broadcast messages.

One potential issue is there is a warning in the Corona simulator, I see the warning
WARNING: unrecognized key: settings.iphone.plist.UIFileSharingEnabled (boolean)

When i open the built app on mac and inspect the Info.plist file I do not see this key.

Any help or insight anyone could offer would be greatly appreciated.

In my experience “crash on launch” is usually plugin related. It’s a slow process, but you might try commenting out all the plugins in build.settings, doing a build and see if you can get a little farther in the launch process. (Obviously, the app will crash as soon as you require one of the plugins, but getting to that point is progress. :grin:) Then add plugins back in until you find the culprit.

I’m afraid it’s not super-specific to your problem, but lacking anything else to go on, that’s where I’d start.

Thank you for taking the time to consider my issue.

Here is my build.settings file:

settings = {
	 plugins =
    {
        -- key is the name passed to Lua's 'require()'
        ["plugin.bit"] =
        {
            -- required
            publisherId = "com.coronalabs",
        },
    },      
	iphone = {
        xcassets = "Images.xcassets",
		plist = { 		
			NSAppTransportSecurity = 
			{
				NSAllowsArbitraryLoadsInWebContent = true,
				NSAllowsArbitraryLoads = true,
				NSAllowsLocalNetworking = true,
			},
            CFBundleName="AshlyRemote",
			CFBundleShortVersionString = "2.07",
			CFBundleVersion = "2.07",
			MinimumOSVersion="17.0",
			UIRequiredDeviceCapabilities={
				"wifi",
				"armv7",
				"opengles-2",
			},
            UIRequiresPersistentWiFi=true,
            UILaunchStoryboardName = 'Launch Screen.storyboard',
			UIFileSharingEnabled = true,	
            LSSupportsOpeningDocumentsInPlace = true,
			UIPrerenderedIcon = false,
			UIStatusBarHidden = false,
			UIApplicationExitsOnSuspend = true,			
		},
		
	},
	orientation = {
		default = "landscapeRight",
		supported = {
			"landscapeRight","landscapeLeft",
		},
	},
}

I commented out the one library like you suggested but that did not resolve the crash issues.

I found one of the Example projects and Built that and it ran on my iPad. It worked well.

Then I deleted all of the code out of that example project and pasted my app code into it. So my app was reusing the launch screen and icons from that project and the build.settings file. This did not resolve crash issues and the console log still contains the same errors.

Next I commented out all of the code accessing and loading files to and from the documents directory.
I commented out all of the lua socket code.

My app still crashes on launch with the same errors.

I am not sure what to make of this. Clearly there is something about my code that iOS does not like.
I just do not see how it could be a permissions issue when I am not using file access or wifi.

OK- my next suggestion would be to liberally sprinkle your main.lua file with print statements to see if you can determine how far the app is getting in to launch before it crashes.

Just helping to enrich information so people can help you solve problems faster:

  1. What version of Solar2D are you using?
  2. And the Xcode version?
  3. Can you test a simple network.* API usage or test the SampleCode Networking/AsynchImageDownload?
  4. It would be helpful to have a more specific log. Can you find your App crash log through Locate crash reports and memory logs on the device? Please remove sensitive information before sharing.

Good suggestion. I use print statements throughout the entire application for diagnostics. I globally replace the lua print function with an empty function when I am not running in the simulator. So if these print statements will show up in the console then I should be able to just uncomment one line of code.

I am using Xcode 15.2 and Solar2d SDK 2024.3706

Good point, I need to break it down to more simple use cases. That will allow me to exclude specific permissions as being the issue.

As far as crash logs, the only crash logs on my iPad that I have found are for (ProcName:icloudsubscriptionoptimzerd), which I assume are because I have not setup iCloud yet.
This is a development iPad and the only apps on it came with it from Apple except this App that I am working on.

At this point I am not sure which console logs to report. I have my orginal version of the app and the one I put into the CoronaCannon example app.

I add some print statements to my open, launch, suspend, exit event handlers.

It looks like my app was receiving the suspend event on launch. Inside my suspend event I performed
an os.exit(). So my app was exiting on launch because it was receiving the suspend event.

I am not sure why I added this force exit. I thought that iOS handled that when you add the UIApplicationExitsOnSuspend=true to your build.settings file, which has always been in my app.

Now that I remove the os.exit from my suspend event handler function, my app launches and runs. This is bizarre weird because that means that the app received the suspend event but still somehow launched and ran.

With a running App I can now move ahead with testing to ensure that the app is still functioning properly.