Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value of type 'UnityAppController' has no member 'unityMessageHandler' #426

Open
faridg18 opened this issue Jun 29, 2021 · 8 comments
Open

Comments

@faridg18
Copy link

Describe the bug
I am past the steps of compiling unity an trying to run the app. Xcode gives me the following message: "Value of type 'UnityAppController' has no member 'unityMessageHandler'"

Screen Shot 2021-06-29 at 10 19 58 AM

**Screenshots**

Unity (please complete the following information):

  • OS: iOS 14.0

Smartphone (please complete the following information):

  • Device:iPhone 12 pro
  • OS: 14.0
@camao-apo
Copy link

I got the same problem and did find out, that sometimes export did not generate proper AppController class.

What i mean is that the changes that are needed for this package are missing.

Just copy those files to your project ( xxxx/ios/unitylibrary/classes/) and it should be fine.
Updated_unity_classes.zip

If you check then you see that there are additional exports which the properties that you need.

@jaboyc
Copy link

jaboyc commented Jul 18, 2021

I had the same issue. Did you find the solution for it @faridg18 ? Copying the files that @camao-apo provided gave me new compiler error, line 454 in UnityAppController.mm "Use of undeclared identifier 'UnityDisplayLinkCallback'"

@mkster
Copy link

mkster commented Aug 3, 2021

I have the same issue, did anyone solve it?

@camao-apo
Copy link

So it seems that export from Unity did not went well.

Two questions:

  1. What version of Unity you are using ?
  2. Do you use DisplayLink capabilities ?

@mkster
Copy link

mkster commented Aug 4, 2021

  1. 2019.4.27f1
  2. As far as I know no (no idea what that is)

@belveder79
Copy link

ok, here's the solution for those that are not able to read the instructions (including myself):

DO NOT USE THE REGULAR BUILD OPTION WITHOUT THE FLUTTER UNITY PLUGIN!

There is a reason for the existence of this plugin, and it is mandatory to do the export for Android and iOS via the "Flutter" menu.

Just for reference, if you are working on the Unity part and you want to "append" instead of build anew, you might have to fix the Build.cs file in the Plugin like this (just in case the "append" function does not work for you).


For iOS, replace this line in DoBuildIOS() -

var options = BuildOptions.AcceptExternalModificationsToPlayer;

with

var options = BuildOptions.AllowDebugging;

For Android, replace this line in DoBuildAndroid() -

var options = BuildOptions.AcceptExternalModificationsToPlayer;

with

var options = BuildOptions.AllowDebugging;
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;

@andyshephard
Copy link

The issue has been asked and answered here: #377

It's an error that's occurring when you're exporting the iOS project from Unity using an older FlutterUnityIntegration package. Use this one (v4.1.0):
https://github.com/juicycleff/flutter-unity-view-widget/blob/master/scripts/FlutterUnityIntegration-v4.1.0.unitypackage

You'll know that it's exported correctly when your UnityAppController.h file contains these changes:
#377 (comment)

NOTE: Be sure to follow the steps mentioned in the above comment by @belveder79 in order to export iOS without errors.

@timbotimbo
Copy link
Collaborator

I just found a reliable way to replicate this error.

Reproduction

  • Set the build target in Unity build settings to anything NOT iOS, like Android or Desktop.
  • Now click Flutter-> Export iOS.

This results in an incomplete build, because any code in
#if UNITY_IOS blocks is skipped.
However you still see the build successful message.

The build script will change the buildtarget automatically, but somehow the #If UNITY_ keeps the old value.

Current solution

Change the Unity build target before clicking Flutter -> Export.

If you use batchmode or command line, make sure to include -buildTarget iOS in your command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants