Unity iOS IPv6 - IL2CPP UnityEngine.Experimental.Networking crash - ios

In order to be able to submit again to the app store (for a published game) we had to make things work for IPv6. So we updated Unity to the version 5.3.5p2 (latest patched version available)
We went through reworking all our networking interfaces (we used to use classic http requests for backend server com and socket connections for asset download) we swapped everything with UnityWebRequest, DownloadHandler and UploadHandler from UnityEngine.Experimental.Networking
Everything works fine on Editor and android but for iOS it just ... crashes.
We are using : Unity 5.3.5p2
xCode 7.2
and iPad2 with iOS 9.3.2
Build settings :
IL2CPP
Universal Architecture (min iOS 7.1)
API Level .Net 2.0
Strip Engine code set to OFF
AOT-Compile options set to : mint-trampoline 512 (we were using this for mono scripting backend)
On Xcode :
Bitcode is disabled
optimisation level set to (for release and debug) : None[-O0]
Here is the error we get on console when the game runs :
Unable to find method GetProgress in
[UnityEngine.dll]UnityEngine.Experimental.Networking.DownloadHandler
.
.
Unable to find method ReceiveContentLength in
[UnityEngine.dll]UnityEngine.Experimental.Networking.DownloadHandler
.
.
[project name] was compiled with optimization - stepping may behave
oddly; variables may not be available.
(we very simply implemented the DownloadHandlerScript with a managed static buffer)
When we build with mono as scripting backend things work fine. But IL2CPP is mandatory for us.
Thank you for your help.

When we build with mono as scripting backend things work fine. But
IL2CPP is mandatory for us.
It is very likely that a function you are calling from UnityWebRequest is not yet implemented in the IL2CPP side or that is a plain bug.
Notice that you are using UnityWebRequest from UnityEngine.Experimental namespace which is clearly an experimental version of UnityWebRequest that is not yet mature. You need to download the latest version of Unity which is Unity 5.4. In 5.4, UnityWebRequest is moved to UnityEngine.Networking namespace and more bugs were fixed in that new release. Download Unity's 5.4.0b21 here.
If that doesn't work, use the Unity WWW API instead of UnityWebRequest. It is IPv6 safe in >= 5.3 versions. Also file for bug report if UnityWebRequest didn't work after updating Unity to 5.4.

This is likely an issue with managed code stripping. I've posted a possible work around on the Unity forums here:
http://forum.unity3d.com/threads/unity-ios-and-ipv6-support.404938/#post-2670944

Related

Firebase storage download trouble in iOS device (Unity)

I met unknown trouble trying to setup firebase storage for iOS. I can't download even 1 file in device, but it runs perfectly in Editor.
I am using reference.GetFileAsync() method. Firstly I assumed that I made some wrong package setup or some other silly mistake, but I checked it many-many times. Each Quickstart project here works well on my end. My current project settings and firebase storage settings are identical to provided test examples I run in iOS device successfully.
Here is a xCode output trying to download the file. That is looped and contains only that info: codeshare
Any of logs googling doesn't give me any solution or even idea.
Please, give me some thoughts where to search the problem.. I am totally confused.
I am using MacOSx, Unity 5.5.0/5.5.1, latest Firebase Unity SDK (v1.1.2)
The reason was that firebase database package automatically changed from .NET Subset to .NET option. Changing back solved the problem. But anyway, that means we can't use firebase storage + database in same iOS project in Unity.. That's bad
Firebase Developer here. I'm sorry you encountered this error and I can confirm this was a regression from our initial build in January. This issue has since been resolved in the latest version of Firebase Storage for Unity (3.0.0.0) released for general availability for mobile at GDC.
The latest version will work with the full .Net SDK which is also required for the realtime database in Unity.

CCMenuItem doesn't work (Xcode 7.3~)

I’m a Japanese game developer. I develop some games with cocos2d-x.
I’m confused by the following problem. So, if you any idea, please help me.
When tap the button put on a cocos2d-x layer, the button doesn’t work.
If the button be tapped, the call-back function of the button doesn’t be called.
I have found some workarounds of the problem. However, I have no idea why the problem occurs. And, I want the most suitable way, how to fix it.
The following are develop environment and mobile devices that the problem occurs.
■ Develop environment
Operating system : Mac OS X El capitan(10.11.5)
Xcode version : 7.3 - 7.3.1(7D1014)
cocos2d-x version : cocos2d-x-3.2
build config. : Test / Release
■ Mobile devices
iPhone4s(iOS 9.3.2), iPhone5(iOS 9.3), iPad mini(iOS 9.3.1)
If mobile device's condition (iOS version etc.) is different, the problem may not occur.
And, the apps built by Xcode 7.2.1 or older version have no problem. it work normally.
The problem doesn’t also occur with the apps built by Debug build mode.
I attach a sample code.
https://github.com/SeanIchikawa/SampleProject/tree/master/CCBTest
The button of the layer is made by ccbi (ccbi = cocos builder file).
The call-back function is referenced to the button by "Selector" in the ccbi file.
■ About the sample Xcode project
Xcode Project name : CCBTest
ccbi file: Resources/simple.ccbi
Class file (written about layer) : Classes/SimpleView.h
If you any idea, please give me.
Thank you for reading my question.
The only way I've found at the moment to work it around is to downgrade Xcode to 7.2.1, having exactly the same problem but with CCButton instead.
Older Xcode versions can be downloaded from here: https://developer.apple.com/downloads/
This issue only occur if you are targeting a 32-bit architecture device with -Os optimization.
Set the optimization to -O1 in your release build could walk around this issue for now.

Native code deployment on iOS

IIRC runtime compilation and linkage to JIT-ed native code is not allowed on iOS. I was wondering does it affect native code that was not compiled on the client machine but a remote build server and deployed and linked to internally. Is the problem "native code generated on the fly" or "native code that has not passed Apple's review process"?
As I know, there's no correct way to dynamic linking in iOS - it's prohibited by Apple.
Also look here please: Can you build dynamic libraries for iOS and load them at runtime?

Implementing LuaCocoa on iOS

It is stated in http://playcontrol.net/opensource/LuaCocoa/other-luaobjective-c-bridge.html that LuaCocoa supports Mac implementation. Thus, the available framework, luacocoa.framework is compiled for Mac platform.
However, I wanted to try to compile it on iOS platform to see if it works. So, I downloaded LuaCocoa source code and tried to compile it on iOS platform. Obviously, there are errors. I have this:
"target specifies product type 'com.apple.product-type.framework', but there's no such
product type for the 'iphonesimulator' platform"
I believe that is due to iOS unable to run dynamic library.
So my question is: anyone successfully compile luacocoa on iOS platform and is there any chance luacocoa able to be used on iOS platform.
If there are better suggestion to bridge ObjC-Lua, do let me know as well.
Have you tried Wax
It is an Lua - Obj-C bridge for iOS that has been around for a long time.
Here is a nice article about it.

Accessing OSX APIs from iOS app running in Simulator for debugging

For debugging purposes I am looking for a way that a iOS app (whose source code I have access to) can communicate with a separate OSX app, e.g. via sockets.
Since an iOS app running in the Simulator runs natively on the Mac, by using specially designed iOS simulator frameworks that route I/O through OSX frameworks, there must be a way that I can achieve that with my own code as well.
Simply adding standard OSX frameworks to the project and using them from within the iOS app does not work:
If I try to load a OSX framework that exists already as a iOS framework, the iOS framework will always be preferred, meaning if a framework function is only available on OSX but not in iOS, I can't get to it. If the framework doesn't exist yet, like Carbon.framework, then I can get the linker tries to load it. For instance, if I'd try to get to SysBeep(), which is part of Carbon.framework, the linker then fails with an error msg when it wants to resolve external symbols that point to other libs that are already loaded as a iOS-only lib.
I've also tried loading a OSX specific framework using dlopen(), but that fails just the same.
In other words:
How can my iOS code get access to the OSX-specific libs additionally?
That's a lot of questions at once. Let's go step by step:
For debugging purposes I am looking for a way that a iOS app (whose
source code I have access to) can communicate with a separate OSX app,
e.g. via sockets.
It's definitely possible to use OS X facilities from within the iOS app process running in the simulator. Using plain sockets would be very simple as the BSD library is identical in both iOS and Mac OS. You can simply compile your C code and it would use the underlying OS transparently.
If you wanted to use an Objective-C API like NSURLConnection you can do this as well. In the simulator your app uses the Mac OS version of Foundation and Core Foundation. In most cases you would not recognize this as the API is very similar.
[...] the linker will have trouble keeping things apart due to name space
collisions [...]
It's not really clear what you are trying yo achieve here. As I explained, the simulator process uses proper Mac OS lower level frameworks directly. It does not make sense to link to higher level frameworks like AppKit since the app does not make use of Cocoa desktop components. That's why there is no NSApplication symbol and the app does not instantiate one. Instead it uses the UIApplication class from the simulator's specially crafted UIKit framework located in
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/UIKit.framework
[...] Building the above then leads to a linker error [...]
That's because the linker is directed to only look into the iPhoneSimulator SDK where no AppKit is present (using a linker flag like -isysroot <path-to-SDK>).
But at this point it's probably worth asking yourself why you want to link to AppKit in the first place. You can set up you interprocess communication without AppKit.
Oh, and to prove that it must be possible somehow, take a look at RubyMotion [...]
In the simulator event handling is done in the "iOS-Simulator.app" process (which is a Mac OS application). To get at these events from within your simulator process you could probably use Quartz Event Services.

Resources