Network not included in Xcode ios build

I need to distribute my native app to ad-hoc users for testing. Build onto my device from Xcode works fine. But when I archive and distribute my app through the Xcode prompts, on install, it says network module not found. Attached is the image. I don’t know where to begin, but maybe there is a better way to distribute the app from an Xcode build? A setting I forgot?

Now I remember why I don’t like working with Xcode. What it can do is remarkably complex, but the result is truly Byzantine for the developer.

XCode 15.3
Solar2d 2024.3706
Lua 5.4.6

I have made a zip of the project if you want to see what is happening. You can install but not actually use the app because the content is subscription content, but it should start without an error. I have cross-posted with Apple.

project zip here

I’m guessing you’ve been using Solar2D for a while, probably went through the process of changing the network module from compiling separately to compiling with the core, and then continuing to use the old project would cause you to find the separate network module and not find it.

Have you tried the latest Project Templates? It is located in /Applications/Corona-3706/Native/Project Template/App/ios.

And make sure to run the /Applications/Corona-3706/Native/Setup Corona Native.app and /Applications/Corona-3706/Native/Setup Corona Enterprise.app at least once to set the Native path to a specific version, in this case 3706, so that you get the core library that contains the network library and not the one that wasn’t included before.

Here are some documents for reference Solar2D Native — iOS.

I have used Solar2d a while, but only occasionally Native. This project was started 2 days ago and built directly from the latest project template, and I run Setup Corona Native.app probably once a day. I have never run Setup Corona Enterprise. I thought it was one or the other. Running them both just now made no difference.

I have read through the documents at least a half dozen times.

The only error I see anywhere else is that when I run the Solar2d simulator it says that the Xcode is out of sync. But that happens every time one is upgraded anyway. You can see the versions in my first post.

Please note that the project compiles and runs perfectly fine in the Xcode simulator and in the Xcode build/install directly to the device. It is the archive/distribution process that breaks it.

I did find a require(“network”) in some old code, and it was triggering the Runtime error. However, when I removed that, I now get a console message:

default	13:18:46.604284-0700	Books Immersed	ERROR: Runtime error
?:0: attempt to index global 'network' (a nil value)
stack traceback:
	?: in main chunk
	[C]: in function 'require'
	?: in function 'require'
	?: in main chunk

The problem is real, either a configuration error or an Xcode bug. I have tried different versions of Xcode (15.1 and 15.4 RC) to no effect.

I don’t know how to resolve this. Apple forums has been silent.

Again, please note the very important distinction: Everything works fine on direct Xcode->device build/install. Everything works fine on Xcode->iphone simulator. Only the archive build is leaving out the network.

I ran without problems with 3706’s native Settings, ios templates, and Sample AsynchImageDownload.

And set Dead code Stripping to Yes, which reproduced the problem of the Runtime Error module ‘network’ not found, that is, Run runs normally but the Archive installation fails to run.

Please try setting it to No or using the original template to try your project again, thank you.

1 Like

Thank you, that was it! All works now. I wonder how that got set to Yes, or maybe that is a new Xcode default? But I still don’t get why so many other modules suddenly went missing after about a dozen builds.

Anyway, thank you very much!

Solar2d forever!

Maybe it was set to reduce the size of the installation package.

Check out Evaluate how your project inherits settings to determine where they are set.

Interesting. I wonder if it had to do with removing the plugin stuff. The template always includes plugin wrappers and settings and modules, because I guess that is a common use of Native. I remove them, and perhaps that disrupts some inheritance chain.

When using Solar2D with Native, you should customize the template, which is generally used as a reference to have very general features and may not be suitable for you.

It is ok to remove it without using the Plugin project module, and because of the way Lua loads modules, the compiler may not be able to tell that luaopen_network actually references the network module, so it is likely to be removed.

1 Like

(red herring)

Never mind. I reset my phone and re-installed, and all works. Bizarre. I think I need to get some sleep. Thank you much for all your help.

1 Like