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

Build iOS, get this: #69

Closed
playstonex opened this issue Oct 23, 2019 · 21 comments
Closed

Build iOS, get this: #69

playstonex opened this issue Oct 23, 2019 · 21 comments
Labels
ios This issue is specific to the iOS/iPadOS Platform.

Comments

@playstonex
Copy link

/Users/desi/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-0.1.6+5/ios/Classes/UnityUtils.mm:55:10: error: no visible @interface for
'UnityFramework' declares the selector 'frameworkWarmup:argv:'
[ufw frameworkWarmup: g_argc argv: g_argv];
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build systemnote: Planning buildnote: Constructing build description

@thomas-stockx thomas-stockx added the ios This issue is specific to the iOS/iPadOS Platform. label Oct 23, 2019
@nickmeinhold
Copy link

I had the same error, for me it seemed to be caused by the post-build script XCodePostBuild.cs not running, as none of the changes were in the exported XCode project.

I exported the project again - the changes in the post-build script were made this time and no more errors. Hope that helps.

@shinriyo
Copy link
Contributor

shinriyo commented Nov 4, 2019

you don't exist the error?

ios/Classes/FlutterUnityWidgetPlugin.m:12:10: fatal error: 'UnityFramework/UnityFramework.h' file not found
    #include <UnityFramework/UnityFramework.h>

@nickmeinhold
Copy link

Did you do this step in the README?
6. Add UnityFramework.framework as a Library to the Runner project

@RomanTechnologies
Copy link

As stated by @nickmeinhold, it seems to be an issue with the XCodePostBuild.cs script not running sometimes once the build has completed.

The script is able to run in Unity after the build by declaring above the required method with [PostProcessBuild], which sticks the method into a list of required post build runs, which the script has.

However sometimes it seems it just wont run, even after exporting multiple times in a row.

What worked for me is to specify the run order for the post build by changing it to [PostProcessBuild(0)] informing Unity you want it to be the first thing run straight after the build, before anything else (if anything else)

I am not sure if it will work for everyone, but I am now getting consistent builds without this issue reappearing.

I hope that helps

@subjectdenied
Copy link

@RomanTechnologies
had the same issue just now, XCodePostBuild.cs doesn't run sometimes for some reason, that means the unity-sources are not patched, and then stuff is missing

however, this doesnt solve the issue with not being able to build the widget cause "UnityFramework/UnityFramework.h" missing, when trying to do a archive build

@OGmetamonkey
Copy link

What worked for me is to specify the run order for the post build by changing it to [PostProcessBuild(0)] informing Unity you want it to be the first thing run straight after the build, before anything else (if anything else)

Can you give a little more information on how to implement this fix?

@subjectdenied
Copy link

@jbrantl8 he is talking about Assets/Editor/XCodePostBuild.cs

on around line 44 change:
[PostProcessBuild]
to this:
[PostProcessBuild(0)]

@OGmetamonkey
Copy link

@jbrantl8 he is talking about Assets/Editor/XCodePostBuild.cs

on around line 44 change:
[PostProcessBuild]
to this:
[PostProcessBuild(0)]

Ok, thanks! Did that, but still getting this error:

'UnityFramework/UnityFramework.h' file not found

I added UnityFramework.framework to Runner like shown in the screenshot here:

Screen Shot 2020-01-23 at 5 34 50 PM

I also added UnityFramework Target Membership to the Data folder like shown in the screenshot here:

Screen Shot 2020-01-23 at 5 36 19 PM

The 'UnityFramework/UnityFramework.h' file not found? seems to be coming from line 12 of FlutterUnityWidgetPlugin.m located in this directory:

flutter/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-0.1.6+5/ios/Classes/FlutterUnityWidgetPlugin.m

Help!!

@subjectdenied
Copy link

@jbrantl8
see my issue about "building archive for ios" #93

basically you have to add the unity-iphone project to both the runner and the pods, and then use the unityframework as a dependency for the flutter-unity-widget (inside pods) in its buildphases

@subjectdenied
Copy link

subjectdenied commented Jan 24, 2020

@jbrantl8 also don't try to build using the flutter cli (i never got this working), only build from xcode

@subjectdenied
Copy link

Bildschirmfoto 2020-01-24 um 01 52 37

@subjectdenied
Copy link

Bildschirmfoto 2020-01-24 um 01 57 49

@OGmetamonkey
Copy link

Wow, thank you! That solved the framework issue. Now getting 2 more errors when building target Runner.:
1.

"___gxx_personality_v0", referenced from:
UnityFrameworkLoad() in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils handleAppStateDidChange:] in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils listenAppState] in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils createPlayer:] in libflutter_unity_widget.a(UnityUtils.o)
___27+[UnityUtils createPlayer:]_block_invoke.70 in libflutter_unity_widget.a(UnityUtils.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbols for architecture armv7:
"___gxx_personality_sj0", referenced from:
UnityFrameworkLoad() in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils handleAppStateDidChange:] in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils listenAppState] in libflutter_unity_widget.a(UnityUtils.o)
+[UnityUtils createPlayer:] in libflutter_unity_widget.a(UnityUtils.o)
___27+[UnityUtils createPlayer:]_block_invoke.70 in libflutter_unity_widget.a(UnityUtils.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like it got through almost everything but that...

Screen Shot 2020-01-23 at 8 00 36 PM

@OGmetamonkey
Copy link

Changing AppDelegate.m to AppDelegate.mm fixes those last errors. I don't fully understand why, other than .mm tells the compiler to recognize both Objective-C and Objective-C++ classes, while .m apparently only does Objective-C classes.

@OGmetamonkey
Copy link

Now getting this. What a disaster.

2020-01-24 12:15:13.996383-0700 Runner[4509:888722] Failed to find snapshot: /private/var/containers/Bundle/Application/41D645BC-ED72-40B3-A7CC-318BA5D81EBE/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin
2020-01-24 12:15:14.090659-0700 Runner[4509:888722] Metal API Validation Enabled
2020-01-24 12:15:14.270753-0700 Runner[4509:888919] flutter: Observatory listening on http://127.0.0.1:64207/nW_SGP6iSEY=/
2020-01-24 12:15:14.282857-0700 Runner[4509:888907] [VERBOSE-2:engine.cc(127)] Engine run configuration was invalid.
2020-01-24 12:15:14.282922-0700 Runner[4509:888907] [VERBOSE-2:shell.cc(437)] Could not launch engine with configuration.

@OGmetamonkey
Copy link

2020-01-24 12:15:13.996383-0700 Runner[4509:888722] Failed to find snapshot: /private/var/containers/Bundle/Application/41D645BC-ED72-40B3-A7CC-318BA5D81EBE/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin
2020-01-24 12:15:14.090659-0700 Runner[4509:888722] Metal API Validation Enabled
2020-01-24 12:15:14.270753-0700 Runner[4509:888919] flutter: Observatory listening on http://127.0.0.1:64207/nW_SGP6iSEY=/
2020-01-24 12:15:14.282857-0700 Runner[4509:888907] [VERBOSE-2:engine.cc(127)] Engine run configuration was invalid.
2020-01-24 12:15:14.282922-0700 Runner[4509:888907] [VERBOSE-2:shell.cc(437)] Could not launch engine with configuration.

FYI ~ Rebuilt the project and didn't have this issue again. Not sure what was causing this. If you know, feel free to chime in. It now works! Thanks a ton @subjectdenied

@MichealReed
Copy link

MichealReed commented Feb 22, 2020

Finally got things running with the flutter run command. I did several things, but the biggest thanks goes to this:

flutter/flutter#17978 (comment)

I also added s.pod_target_xcconfig = {'VALID_ARCHS' => 'arm64'}'

This will need to be revisited when unity as a library supports the simulator, but should work until then.

Note: this fix isn't something that should be pulled into master. I will continue to monitor the thread until a fix is found that doesn't require UnityFramework.framework to be moved in this fashion.

@ideva-SAS
Copy link

Hello
Thanks for this solution, I manage to build the application on my device without any errors.
But when I do a Product / Archive, I get an error:
image
Could you help me plz ?

Best regards

@juicycleff
Copy link
Owner

Check the updated example. Its a lot easier now to set up on iOS

@Ahmadre
Copy link
Collaborator

Ahmadre commented Aug 15, 2020

Check the updated example. Its a lot easier now to set up on iOS

We need more info! Screenshots, paths, better readme, anythimg, but not a single sentence :(

@uuttff8
Copy link

uuttff8 commented Dec 13, 2020

same problem here, nothing helps

EDIT: Building for real device helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ios This issue is specific to the iOS/iPadOS Platform.
Projects
None yet
Development

No branches or pull requests