I have a problem about Unity for IOS, Details as following:
I export the IOS native project from Unity, and then I copy the project file to another IOS native project,but there were many errors,like this:
It appears these libraries are missing. Installing same version of Unity iOS should fix this. Check your project structure as well https://docs.unity3d.com/Manual/StructureOfXcodeProject.html Is the iOS version same on both platforms?
Edit: You are either missing some libraries required, the structure of your project is not right or you are running different versions of unit. Download and install same versions of unity on both platforms. https://unity3d.com/get-unity/download.
Test run the following code in your other IOS native project:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Start() {
Screen.orientation = ScreenOrientation.LandscapeLeft;
}
}
Share the results of above script.
Unity is supposed to be platform independent but the code may break on different versions, what unity versions are you using?
Related
We are trying to build a KMM (Kotlin Multiplatform Mobile) app for ios and android. There are c/c++ modules included in this project.
At iOS build we are getting this error from a .h file:
error: use of '#import' when modules are disabled
In xcode this seems like an easy problem to fix, but in Android studio, we can't find a solution. I'm thinking this is a Podfile/.podspec issue, but I haven't been able to find any working solution.
instead of :
#import MyModule;
just try :
#import <MyModule/MyModule.h>
I need some advice about building react native library that using framework. I'm trying to build one using this library. My react native library contains these files:
Sample-Bridging-Header.h
Sample.m
Sample.swift
Sample.xcodeproj/
Utilities/Utility.swift
Utilities/Helper.swift
Test.framework
Inside my Utility.swift and Helper.swift, I import library Test and there is no issue there.
However, when I build the sample app which uses the library, it will not build and it gives the error no such module 'Test'.
So it looks like if the main application try to use the react native library, and if the library uses a framework, the main application can't reference the framework. I'm not sure if this is the right approach or not.
I built react native library before and it worked for me but I never have to reference any framework.
Appreciate any help! Thanks!
Actually I just figured out how to handle this. I just need to update the podspec to include the framework by using s.ios.vendored_frameworks = ios/Test.framework.
Once I did that, I run pod install again for my example project. So now it can pull the framework in properly.
I want to import a library from native C source code to be used Unity, for iOs. I expect to require the .a binaries and the .h header (and any other file required if I'm missing any), but I cannot find any guide around about how to build it.
I tried to build the source code directly on Xcode, but I was not able to create a library from that. XCode accepts native C only with command line project, while I need a library.
Then I tried to run this CMake command on mac terminal:
cmake . -DCMAKE_SYSTEM_NAME=iOS "-DCMAKE_OSX_ARCHITECTURES=arm64;arm64e" -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3 -DENET_STATIC=1 -DENET_LZ4=1 -GXcode
This creates an Xcode project, I build it for generic IOS but the code does not work on unity when I deploy it on the device.
A good place to start is the Bonjour example from the Unity Manual. This at least gives you a working iOS plugin as a starting point.
You include the files in your Unity project, and build for iOS. You will notice that the files under Plugins/iOS are automatically included in the generated Xcode project. They will only be compiled when you build/run your Xcode project.
Careful, an iOS plugin is not the same as a MacOS plugin. For a MacOS plugin, you will need to create the bundle and include this into your UnityProject. The DllImport decorator will also be different on your C# code. For iOS it is "__Internal", but for MacOS it is the name of the bundle.
If you are trying to interface with a third party library, you may need to manually modify the library search paths of your Xcode project to correctly locate your .a and .h files when building and linking.
As a side note, when including a third party .a binary, verify that it conforms to the iOS architecture requirements, otherwise your app may be rejected when submitting to the app-store.
I have been trying to create a git repo with my framework and trying to distribute it using pods. I have written a podspec which downloads all the dependencies as well as my framework. The pod functions properly. I even imported the framework to the appDelegate of the sample project to test its functionality.
Now when I am using a class of that framework I am getting the following error
'MyClass' is unavailable: cannot find Swift declaration for this class
I have tried to build the project for both simulator and iPhone, but the result being the same.
Does anyone has insight on this one?
I have developed Unity iOS project. I am using some 3ds max model files in it with some animation. When I create project through Unity, it does creating it automatically and installing it on the iPad. Now, I want to include this unity based functionality into my existing iOS project. How can i separate this unity project and integrate into my existing iOS Xcode project? I see lot of dependancies in Unity created project. I don't know the steps how can we separate this and integrate into any existing iOS Xcode project?
Please advise!
Here's how we did it using Unity 5.2.2f1, Xcode 7.1 and Swift 2.1.
The steps outlined in the link below seem like a lot, but honestly, aside from the Import/Cleanup of some of the unity files, it takes < 5 min once you know the steps.
https://github.com/blitzagency/ios-unity5
Actually thats not THAT hard to do. But honestly i would recommend not to try to integrate the generated project into your own, but start with the generated project and integrate yours. Since usually your part of the project will have a lot less changes in the build settings and dependencies.
Once you done the integration, you can update from a new export by simply copying the Classes and Libraries Folder from the generated project to the integrated one.
I explain how we integrated Unity into our iOS App in more detail here: http://www.markuszancolo.at/2014/05/integrating-unity-into-a-native-ios-app
regards