opengl_texture_widget_example
opengl_texture_widget_example copied to clipboard
Can't run on iOS device - can't find flutter.h
First of all, great work on demonstrating GL code working in Flutter!
No expectation of support, but I was hoping you may happen to have some insight. I want to run your demo code on an iOS device! Here's my macbook environment:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.3.14-pre.17, on Mac OS X 10.14.3 18D109, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[!] Android Studio (version 3.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.32.3)
[✓] Connected device (1 available)
Using VSCode I had no problem running on Android device, but xcode build seems to fail this way:
Launching lib/main.dart on adowdy-iPadMini4 in debug mode...
Signing iOS app for device deployment using developer identity: "iPhone Developer: [email protected] (43NXACPF3H)"
Xcode build done. 1.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/dev/opengl_texture_widget_example/ios/Classes/SampleRenderWorker.m:8:
In file included from /Users/dev/opengl_texture_widget_example/ios/Classes/SampleRenderWorker.h:8:
/Users/dev/opengl_texture_widget_example/ios/Classes/OpenGLRender.h:8:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the precompiled application for the device.
Error launching application on adowdy-iPadMini4.
Exited (sigterm)
I'm actually wondering how to debug this because I don't know how flutter is jumping into xcode. Would a workaround be to try to somehow link to flutter in the xcodeproject and provide header paths?
Cheers!
Ran into this as well. The Podfile
included in this repo is a bit out of date. The easiest way to get it regenerated is to delete it as well as Podfile.lock
, then do flutter run
. This will regenerate using the latest template.
Then I ran into another problem:
=== BUILD TARGET opengl_texture OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/kent/Repository/opengl_texture_widget_example/ios/Classes/OpenGLRender.m:75:12: error: nullability specifier 'nonnull' conflicts with existing specifier '_Nullable'
- (nonnull CVPixelBufferRef)copyPixelBuffer {
^
1 error generated.
It seems the signature for copyPixelBuffer
has changed in flutter, so I had to modify OpenGLRender.m
to match:
- (CVPixelBufferRef _Nullable)copyPixelBuffer {
I can confirm as of 2020.11, this example works on Flutter 1.22.4 with following patch:
- Change the
copyPixelBuffer
signature as above. - Remove
Podfile
andPodfile.lock
(and don't checkin the new generated ones, this makes Flutter generate other boilerplate files automatically). - Update provision file setting.
- Add following to
pubspec.yaml
:
environment:
sdk: ">=2.0.0 <3.0.0"
Then flutter run
should do the trick. Thanks for providing this example!
For Android build, the compileSdkVersion
should be set to 28