Hello, I’m trying to load some external assembly code that is downloaded from the web into an iOS application that is running. This works fine on all the platforms, (pc, webplayer, mac) except the iOS, it just crashes and gives me a status 1 error that means nothing to me.
You entirely can’t do that. It’s not supported by Unity iOS due to all of its code being compiled ahead of time, and it’s not allowed by Apple due to their security restrictions.
I can do it fine on the Mac itself and the simulator, thats pretty dumb if so.
This is the errors I get when I try to do Assembly.Load if it means anything to anyone
Non platform assembly: data-0x1254200 (this message is harmless)
Failed to load AOT module ‘data-0x1254200.dylib’ in aot-only mode.
Debugger stopped.
Program exited with status value:1.
Mac OS doesn’t have that restriction, so it works on the simulator too. In general, the simulator is not a terribly good indication of how or whether an iOS program will run.
well that makes it very…useless
Indeed. In my experience it’s only really good for testing layout.
I guess I’ll try to find a way to eval the c sharp scripts as needed. Theres gotta be a way to do that.
I recommend against it. If you do find a way, Apple is likely to figure out what you’re doing and will reject your app.
Then how the heck do they expect us to have expanding, or database driven content that isnt just data driven.
Database driven is no problem and data driven neither, as the code that interprets and acts upon the data is present in the application and there is also no “legality problem” with this. Thats how engines with script code work for example as all the compiled “real code” is static and the scripting can only access those functions provided in the real code.
Just to clear that up, unity on no platform is scripting although its wording implies it a lot. In reality all code is compiled to CIL code, in case of iOS and consoles to native platform code without CIL (cil would violate the ruling of no code generation at runtime as well)
Expanding code is possible only through updating the app. injecting code at runtime will get you rejected, if they detect it later it will get removed, potentially even blacklisted and your account suspended.
All native code your application uses has to be present at approval time.
In case of unity you can’t do it anyway, as reasonable usage of assembly load requires full reflection which isn’t possible at all with .NET and AOT
Thanks for the reply. I gave up on it. What I want is real scripting (like you said all of the code in unity gets compiled into CIL code) that can be added to the project to just control a limit level of behaviors not, open it up completely by injecting assembly code. This was just one of the options I was exploring. I’m starting to think that a XML translator to do the job.