Add Unity3D to native iOS App with Unity 5 and Vuforia 4.x

DEPRECATED WARNING: This was made with a Unity 5.0 Version in 2015 i think.
So this may not be working. Also it is very hacky to bridge native App with iOS – just dont do it and deploy directly from Unity (this is the usual way).

Sometimes you need to add Unity to an existing App. As by design Unity is designed to run “standalone”. So you got a ready to deploy xCode Project.

This tutorial is just an “update” or “extension” to a Tutorial found at “the-nerd.be” (many thanks mate for your help).

You can find it here : http://www.the-nerd.be/2014/09/08/sandbox-unity-app-in-existing-ios-app/

As the Tutorial was made for Vuforia 4 and Unity 5 – it is really fresh and new.

 

1. Create Unity Project

As usual – just create your project. Add some stuff or whatever you want to do there.
If you want to use Vuforia just download Vuforia from their Site (current stable Version 4.0.). Also you need to create a new License.
So on Vuforia Site when you are signed in just go to “Develop -> License Manager” and create a new License.

Copy the License to the Clipboard.
Next add the ARCamera from “Qualcomm Augumented Reality -> Prefabs” Project folder to your Scene. Mark the Camera in the Scene and add your License Key to “App License Key” in QCAR Behavior Script.

qcar_key

Now you are ready to export your Project to iOS.
Like the the-nerd.be i would prefer you to have a good structure where you easily access the unity-iOS build from your project.

Here is my setup:

– mainfolder (or something like your Desktop for example)
–> UnityIOSProject
–> MyAwesomeAppProject

The following player settings should be set:
– Scripting Backend: IL2CPP
– Architecture: Universal

IMPORTANT: it MAY be necessary to change “Graphics API” to “Open GLES 2” or “OPEN GLES 3”. Automatic cause on 64 Bit Devices to use Metal (and Metal also too) and Metal seems to crash currently in Unity 5.

The rest is up to you – i hope so 🙂

 

2. App Controller Subclassing

To build your UIKit + Unity App you need to subclass the AppController.
Create your “MyUnityAppController.mm” in your Unity Project in “Plugins/iOS” , and edit it with xCode and place the following content.

Short explanation: the most contents is from vuforia controller.
Important is the new “willStartWithViewController” (as createViewHierarchyImpl is deprecated since Unity 5.x and doesnt work anymore).
It creates the UIView Hierarchy.
Unity will not show currently anymore.

NOW you can export your iOS build.

3. Libraries, Classes and Settings

So after your project got exported we come now to the tricky parts.
Locate the Folder “classes” and “Libraries” from your iOS Export build. Open your Awesome App Project and drag both folder to your Project.

Uncheck “Copy items if needed” and check “Create Groups”.
Now you have some time and you can go and take a coffee 🙂

After all is copied :
– Open your Project Settings and switch to “Build Phase” Tab.
– For nearly all .mm and .cpp files thats are inside classes or libraries add the following compiler flags: -fno-objc-arc . EDIT: it seems that this isn’t necessary anymore as as unity was forced to build against iOS 5.1 with ARC. So every class is now ARC compliant (and should compile as well).
Now we have to change some Settings.

Add the following to the “Other Linker Flags
-lc++
-weak_framework
CoreMotion
-weak-ISystem

Add the following to the “Other C Flags
-mno-thumb
-DINIT_SCRIPTING_BACKEND=1

Change “C Language Dialekt” to “C99[-std=c99]
Change “C++ Language Dialekt” to “C++ 11[-std=c++11]
Change “C++ Standard Library” to “libc++ (LLVM C++ standard Library with C++11 support)
Change “Enable Modules (C and Objective-C)” to “YES

Add the following “User-Defined” Values:
GCC_THUMB_SUPPORT  NO
GCC_USE_INDIRECT_FUNCTION_CALLS  NO
UNITY_RUNTIME_VERSION 5.0.0.f4 (this depends on your version – check your plist from the iOS Project)
UNITY_SCRIPTING_BACKEND il2cpp

Add  “Header Search Path” relative to your iOS Project like this:
${SOURCE_ROOT}/../UnityIOSProject/Classes
${SOURCE_ROOT}/../UnityIOSProject/Libraries/libil2cpp/include
${SOURCE_ROOT}/../UnityIOSProject/Libraries/bdwgc/include
${SOURCE_ROOT}/../UnityIOSProject/Classes/Native

Add “Library Search Paths” relative to your iOS Project like this:
${SOURCE_ROOT}/../UnityIOSProject/UnityIos.xcodeproj/Libraries
${SOURCE_ROOT}/../UnityIOSProject/UnityIos.xcodeproj/Libraries/Plugins/iOS

In “Run Script” add the following Script (modify the pathes to your own pathes)

This copies the Data Directory from your UnityIOS Project to your project on build.

In your info.plist add the following key (if not present)
Unity_LoadingActivityIndicatorStyle -1

 

4. Add Unity to your View

In your View Controller where you want to show Unity place the following in the “viewDidAppear” or “viewDidLoad” Method

If everything goes well (which doesnt mostly …) you can start your app and see your unityView in your ViewController.

5. Some Thoughs

After i did this some weeks with Unity 4.6.x , Vuforia 3 and Unity 5 and Vuforia 4 and switching from Mono to IL2CPP i must say – iOS and Unity are no BIG friends at all for this kind of usage for a native app.

To compare this: in Android i just created an Activity for Unity and Vuforia (copied by generated source code – just to implement some custom stuff there), added permissions etc in the Manifest, copied some libs and jars (REALLY some!) and that was it.
As in Android it is compiled as jar you dont have 10 millions wrapper files and classes.

Also i hate it that the 7000 Files in iOS slow down the xCode Enviroment and compiling take 10 minutes or more.

I hope it helps someone – as there is no guide out there for it 🙂

If you have questions – feel free to comment.

54 comments

  • As with the other tutorial you link to I cannot get that or your example to compile due to errors. I do get far fewer with your example but errors all the same 🙁

    For example in main.mm:
    UnityParseCommandLine(argc, argv) …..use of undeclared identifier

    NSlog(@”-> registered mono modules %p\n”, &constsection …..use of undefined identifier

    I have tried the other tutorial from scratch three time and this one, twice and am still unable to get this to work?

    Could you post the sample project so I can see if that does work and then try to figure out where it is all going wrong?

    Thanks

  • Thanks for this awesome guide!

  • Again, after numerous attempts I still no closer?

    The best i am getting now is 180+ warning re methods never being used and errors like #include “RegisterClasses.h” file not found.

    Would really help if you post a project that shows that this actually does work…because Ive drawn a blank!

    • Hi,
      you will get much warnings like “never being used” – this is okay.
      The Include Error is something other – if you still get them remove the Class and Library Directory from your Project (Mark and Remove Reference) and add them again to the Project.
      This should solve the most problems.

      • Sorry still get loads of warnings re no declaration of NSObject etc etc

        I have followed your guide through countless times with the same result.

        I’m sorry I just don’t see how this works although others seem to????

        Could you at least post a project that shows this working?

        Am I supposed to create the other guys project first then amend to yours?

        Am I to start afresh with yours?

        Either way this just does not work for me?

        • Copy the content of the main.mm file in the Classes folder of the generated ios build from unity and paste in your main.mm in Supporting files folder from your xcode project. You won’t get the include error RegisterClasses.h file not found anymore.

  • Hi,

    I am an iOS Dev and is looking into launching a UIView from inside a Unity app is this possible?

    I understand your guide above is about embedding the unity app into a native app.

    Thanks

    • You can do this with a extern “C” Callback.

      Just in your Script define the following example method:
      [DllImport("__Internal")]
      private static extern void myExampleExternMethod ();

      In your ObjectiveC (.mm) class you can know build the Objective C Method:

      extern "C"{
      void myExampleExternMethod(){
      // Do some ObjectiveC Stuff here
      }
      }

      Hope this helps

  • What an absolute godsend. Thank you!

    I was missing the run script and bashing my head against the wall for hours.

  • Great beat ! Ӏ would liкe to apprentice while yoս
    amnend yoսr website, ɦow can i subvscribe fοr a blog web
    site? Thе account aided mе а acceptable deal.

    І hɑԁ been a littlе bit acquainted օf this your broadcast provided bright cleɑr idea

  • Getting a “unknown argument: -weak-ISystem” error.

  • can you upload the whole project for our reference. very thanks’.

  • I believe “-weak-ISystem” was meant to be “-weak-LSystem”.

    I have been unable to get this working, any help would be great:
    http://forum.unity3d.com/threads/unable-to-merge-unity-into-our-application.330650/

  • Hi,
    When i create MyUnityAppController.mm, in line 71 “IMPL_APP_CONTROLLER_SUBCLASS(AMUnityAppController)” should not be IMPL_APP_CONTROLLER_SUBCLASS(UnityAppController) instead?
    Thanks

  • Hi, i’m starting developing both xcode and unity.
    I’m triyng to add unity + vuforia to an existing project, i noticed that you are doing an update to another tutorial.
    U don’t say nothing about the main’s files . What should i do to the main.mm in Classes folder and main.m of my ios app?
    Thanks

    • Copy the content from main.mm in Classes folder to main.mm in supporting files folder of your ios app. Then delete the one in Classes folder.

  • Hi,
    Can you upload some example project? I’ll try to mix both tutorials in order to adapt it to mine. I has been imposible. I get stuck on main.mm stuff.

    • When you create your ios build from unity, copy the content from main.mm inside Classes folder and paste it in your main.mm file in supporting files folder of your xcode project. You don’t need to modify anything!

  • Pingback: Unable to merge Unity 5 into our iOS application | DL-UAT

  • Ok, I finally got it, but I have a last question. Is there a way to pause Unity at the beggining of execution and playing it before showing its view? How can be this done?
    Thanks

  • After some rounds with a lot more build errors i ended up with this error from the compiled MyUnityAppController, when i will build the project:

    “Undefined symbols for architecture arm64:
    “_UnitySetGraphicsDevice”, referenced from:
    -[MyAppController shouldAttachRenderDelegate] in MyUnityAppController.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)”

    Any hints?

    (Unity 5.1.0f3, Vuforia 4.2.3, XCode 6.3.2 (6D2105))

  • Hello! Very useful! But I have some questions:
    1) what is “Run script”?
    2) when I build a project two errors are showing:
    clang: error: no such file or directory: ‘mno-thumb’
    clang: error: no such file or directory: ‘DINIT_SCRIPTING_BACKEND=1’
    why it happens?

    • mno-thumb is a build setting (like DINIT_SCRIPTING_BACKEND=1 too) – so this shouldnt be a file or directory lol.
      “Run Script” is a Option in the “Build Settings” too.

  • I solved my problems with errors, but new was added(

  • I cant make this work for some reason. It’s seems like the Unity Code can’t access UIKit.

    ~/WhatsThisAppWithUnity/WhatsThisApp/UnityIOSProject/Classes/UI/UnityViewControllerBase.mm:5:38: Cannot find interface declaration for ‘UIViewController’, superclass of ‘UnityViewControllerBase’.

    And 26 more errors,mostly “Expected a type” Parse issues.

    Can any help me with that? 😉

    • Did you add the frameworks in build phases under Link Binary With Libraries?
      UIKit.framework,QuartzCore.framework, etc.
      You need to create a pch file to include the headers. Copy the prefix.pch file from the Classes folder generated by unity when building the project for ios. Create then a .pch file (File -> New -> File…) and paste the content in here.
      Did you set the path to your pch file in build settings under Apple LLVM 6.1 – Language? Also set precompile prefix header to Yes.

  • Thanks for post. Can you share project source ?

  • Hi Neo, I followed the first tutorial in the-nerd and this one, and I’m still having troubles. Specifically with this error:

    Undefined symbols for architecture armv7:
    “_GetAppController”, referenced from:

    I also checked this question in Stackoverflow (http://stackoverflow.com/questions/30632736/unable-to-merge-unity-5-into-our-ios-application) but with no solution.

    Do you know what is happening? I have XCode 6.3.2 and Unity3D 5.1.1f1.

    Thanks!

    Joel

    • did you add these to your header file?
      #import “UI/UnityView.h”
      #import “UI/UnityViewControllerBase.h”
      #include “UnityAppController+ViewHandling.h”

  • Pingback: Unity3D - dsjang2 | Pearltrees

  • Can you delete my previous post, please?

    This is what i wanted to paste:

    Undefined symbols for architecture arm64:
    “_UnitySetGraphicsDevice”, referenced from:
    -[ArAppController shouldAttachRenderDelegate] in ArAppController.o
    “_GetAppController”, referenced from:
    -[ViewController viewDidLoad] in ViewController.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Can you help? thanks.

  • Thanks for a great tutorial!
    I followed your guide exactly and can’t compile my project (or, in fact, the ios project that built with Unity).
    I’m getting compiler error ‘symbol(s) not found for architecture arm64’ error when I call any function from UnityView in objc.

    I’ve made sure I’ve selected IL2cpp and ARM64 in my Unity’s Player Settings for iOS.
    My unity version is 5.1.2f1.

    Do you have any advice!

    • Hmm – maybe you have a class “twice” there ? Like main.mm for example.

      It is some monthes ago so cannot say what this could cause – sorry.

  • We are mostly graphic designers, but even me who did programming, it is easy to get lost, and I can’t identify some parts. Maybe a Screen-Capture and a YouTube video would help. Even our IOS developers could not follow unfortunately. I think my company would hire somebody who can fix this problem.

  • Hi, finding this post is a bless~!

    I have a question

    in MyUnityAppController.mm there is

    IMPL_APP_CONTROLLER_SUBCLASS(AMUnityAppController)

    What is “AMUnityAppController”?
    Thanks~!

    • Thank you for your feedback and i changed it to “MyUnityAppController” – cause it was a mistype.
      Sorry for that.

  • #include “codegen/il2cpp-codegen.h” file not found error

  • Hello,

    I’m using vuforia 5, unity 5.1.2f1 and Xcode 6.4 version. Building an iOS app which uses unity scene for AR. Followed this tutorial… Some errors still exist… example codegen/il2cpp-codegen.h file not found.I have added the path in header paths. Can someone suggest what to do?? I’m stuck

  • Abelardo Marquez

    1) I added the MyAppController code but I get the same error some guys around here said and no answer was found yet:

    “_UnitySetGraphicsDevice”, referenced from:
    -[ArAppController shouldAttachRenderDelegate] in ArAppController.o
    “_GetAppController”, referenced from:
    -[ViewController viewDidLoad] in ViewController.o

    2) So what I did was to comment the #If part and then it works. Everything goes smooth there My view loads and the app works. Then, I have a button to start the UnityView (the AR). I add the following to the method after pushing the button:

    UnityRequestRenderingResolution(GetAppController().rootView.frame.size.width, self.view.frame.size.height);

    // This adds the UnityView finally
    [self.theView addSubview:(UIView*)GetAppController().unityView];
    [self.theView setNeedsLayout];

    Next thing you know, the unityView loads but the screen is BLACK. Is you get an AR marker nearby you can see the 3D animations but NO camera view.

    I’m working with Unity 5.1.1f1 , Vuforia 4.3.2, Xcode 6.4 and iOS 8

    //////

    3) Also, I know this might be a lot to ask but, is it possible to share the source code?

    Thanks!

  • For the people still looking for a way to do it in Unity 4 I have updated my article with a video tutorial to embed Unity3D within a native iOS application using a new method (which takes some orientation issues away)

    Updated article can be found on http://www.the-nerd.be/2015/08/20/a-better-way-to-integrate-unity3d-within-a-native-ios-application/

    Cheers,
    Frederik

  • I Follow all step from this link:https://vimeo.com/136835530
    but i get This error

    ProcessPCH /var/folders/tz/p5p7gd2d6_vbnd5wgbz401kc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/PrefixHeader-dpvnmctadimaxhfrlhtsohlpahxl/PrefixHeader.pch.pch PrefixHeader.pch normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd “/Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial”
    export LANG=en_US.US-ASCII
    export PATH=”/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c89 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/dilip/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/dilip/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -fno-objc-exceptions -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -fembed-bitcode-marker -iquote /Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/NativeUnityTutorial-generated-files.hmap -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/NativeUnityTutorial-own-target-headers.hmap -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/NativeUnityTutorial-all-target-headers.hmap -iquote /Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/NativeUnityTutorial-project-headers.hmap -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/Debug-iphoneos/include -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/…/…/Unity/IOS_build/Classes -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/…/…/Unity/IOS_build/Classes/Native -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/…/…/Unity/IOS_build/Libraries/libil2cpp/include -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/DerivedSources/arm64 -I/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/NativeUnityTutorial.build/Debug-iphoneos/NativeUnityTutorial.build/DerivedSources -F/Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/build/Debug-iphoneos -DINIT_SCRIPTING_BACKEND=1 -MD -MT dependencies -MF /var/folders/tz/p5p7gd2d6_vbnd5wgbz401kc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/PrefixHeader-dpvnmctadimaxhfrlhtsohlpahxl/PrefixHeader.pch.d -c /Users/dilip/Downloads/native-ios-and-unity3d-master\ 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch -o /var/folders/tz/p5p7gd2d6_vbnd5wgbz401kc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/PrefixHeader-dpvnmctadimaxhfrlhtsohlpahxl/PrefixHeader.pch.pch –serialize-diagnostics /var/folders/tz/p5p7gd2d6_vbnd5wgbz401kc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/PrefixHeader-dpvnmctadimaxhfrlhtsohlpahxl/PrefixHeader.pch.dia

    While building module ‘UIKit’ imported from /Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch:19:
    In file included from :1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:12:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:13:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:13:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDynamicBehavior.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIGeometry.h:32:1: error: unknown type name ‘inline’
    UIKIT_STATIC_INLINE UIEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) {
    ^
    While building module ‘UIKit’ imported from /Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch:19:
    In file included from :1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:16:36: note: expanded from macro ‘UIKIT_STATIC_INLINE’
    #define UIKIT_STATIC_INLINE static inline
    ^
    While building module ‘UIKit’ imported from /Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch:19:
    In file included from :1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:12:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:13:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:13:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDynamicBehavior.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIGeometry.h:32:33: error: expected ‘;’ after top level declarator
    UIKIT_STATIC_INLINE UIEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) {
    ^
    While building module ‘UIKit’ imported from /Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch:19:
    In file included from :1:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:12:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:13:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:15:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h:11:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:37:8: error: unknown type name ‘inline’
    static inline BOOL UIDeviceOrientationIsPortrait(UIDeviceOrientation orientation) __TVOS_PROHIBITED {
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:37:19: error: expected ‘;’ after top level declarator
    static inline BOOL UIDeviceOrientationIsPortrait(UIDeviceOrientation orientation) __TVOS_PROHIBITED {
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:49:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,strong) NSString *name; // e.g. “My iPhone”
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:50:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,strong) NSString *model; // e.g. @”iPhone”, @”iPod touch”
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:51:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,strong) NSString *localizedModel; // localized version of model
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:52:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,strong) NSString *systemName; // e.g. @”iOS”
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:53:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,strong) NSString *systemVersion; // e.g. @”4.0″
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:54:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly) UIDeviceOrientation orientation __TVOS_PROHIBITED; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:56:1: error: unexpected ‘@’ in program
    @property(nullable, nonatomic,readonly,strong) NSUUID *identifierForVendor NS_AVAILABLE_IOS(6_0); // a UUID that may be used to uniquely identify the device, same across apps from a single vendor.
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:58:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly,getter=isGeneratingDeviceOrientationNotifications) BOOL generatesDeviceOrientationNotifications __TVOS_PROHIBITED;
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:59:1: error: missing context for method declaration
    – (void)beginGeneratingDeviceOrientationNotifications __TVOS_PROHIBITED; // nestable
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:60:1: error: expected method body
    – (void)endGeneratingDeviceOrientationNotifications __TVOS_PROHIBITED;
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:62:1: error: unexpected ‘@’ in program
    @property(nonatomic,getter=isBatteryMonitoringEnabled) BOOL batteryMonitoringEnabled NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // default is NO
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:63:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly) UIDeviceBatteryState batteryState NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // UIDeviceBatteryStateUnknown if monitoring disabled
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:64:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly) float batteryLevel NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // 0 .. 1.0. -1.0 if UIDeviceBatteryStateUnknown
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:66:1: error: unexpected ‘@’ in program
    @property(nonatomic,getter=isProximityMonitoringEnabled) BOOL proximityMonitoringEnabled NS_AVAILABLE_IOS(3_0); // default is NO
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:67:1: error: unexpected ‘@’ in program
    @property(nonatomic,readonly) BOOL proximityState NS_AVAILABLE_IOS(3_0); // always returns NO if no proximity detector
    ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    /Users/dilip/Downloads/native-ios-and-unity3d-master 4/tutorial/ios/NativeUnityTutorial/PrefixHeader.pch:19:9: fatal error: could not build module ‘UIKit’
    #import
    ~~~~~~~^
    21 errors generated.

  • It tell me “no such file on directory :core Motion”, but I had add the framework in my project

    • Well maybe some things did change – so this article is a year ago (and i didnt needed it anymore than).
      Also it feels really hacky building a bridge between engine and app.

  • Will someone merger succeed? It can provide some examples ?please..

Leave a Reply

Your email address will not be published. Required fields are marked *