-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Build Flutter app as a framework on iOS #8971
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
Conversation
Dynamic libraries outside of a framework bundle are not supported on iOS, except for the system Swift libraries provided by Xcode. See: https://developer.apple.com/library/content/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING_BUNDLE_ERRORS-EMBEDDED__DYLIB_FILES
|
Fixes #8075 |
xster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename the frameworks too?
| <key>CFBundleExecutable</key> | ||
| <string>App</string> | ||
| <key>CFBundleIdentifier</key> | ||
| <string>io.flutter.flutter.app</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be true? Won't this need to be unique to the app in question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, I doubt it matters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the identifier of the framwork, the application identifier is still specified in a separate Info.plist.
THIS IS A BREAKING CHANGE. See below for migration steps for existing projects.
Previously, Flutter app code was built as a raw dylib on iOS. Dynamic libraries outside of a framework bundle are not supported on iOS, except for the system Swift libraries provided by Xcode.
See:
https://developer.apple.com/library/content/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING_BUNDLE_ERRORS-EMBEDDED__DYLIB_FILES
app.dylibtoApp.frameworkflutter createtemplateMigration steps for existing projects
The following steps should be taken from the root of your Flutter project:
ios/.gitignore: add/Flutter/App.frameworkon a new line.app.dylibfrom the Flutter folder. Delete this file from theios/Flutterdirectory in your project.ios/Flutter/App.framework. From the command line, runflutter build ios. If you have not configured app signing in Xcode, an alternative method is to open the simulator, then runflutter run -d iP.Runnerproject. In the project settings that are displayed in the main view, ensure that theRunnertarget is selected. You can verify this by exposing the sidebar using the [| ] icon in the upper-left corner of the main view.App.framework. In the sheet that drops down, click the Add Other... button. Navigate to theios/Flutterdirectory and selectApp.framework. Click Open. In the sheet that drops down, select Create folder references, then click Finish.App.frameworkhas been added to the Embedded Binaries and Linked Frameworks and Libraries lists.App.frameworkunder the Flutter folder.ios/Flutterdirectory of your project.Flutterthen from the File menu, select Add Files to "Runner".... Navigate to theios/Flutterdirectory, selectAppFrameworkInfo.plistand clickthe Add button.
flutter build clean, thenflutter run.The final state of your project should appear as follows:

At this point your project should be fully migrated.