• Chris Bracken's avatar
    Build Flutter app as a framework on iOS (#8971) · 0ee3f57a
    Chris Bracken authored
    **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
    
    * Migrates Xcode build from app.dylib to App.framework
    * Migrates flutter create template
    * Migrates example projects
    
    Migration steps for existing projects
    =====================================
    
    The following steps should be taken from the root of your Flutter
    project:
    
    1. Edit `ios/.gitignore`: add `/Flutter/App.framework` on a new line.
    2. In the Xcode project navigator, remove `app.dylib` from the Flutter
       folder. Delete this file from the `ios/Flutter` directory in your project.
    3. Run a build to generate `ios/Flutter/App.framework`. From the command
       line, run `flutter build ios`. If you have not configured app signing
       in Xcode, an alternative method is to open the simulator, then run
       `flutter run -d iP`.
    4. In the Xcode project navigator, select the `Runner` project. In the
       project settings that are displayed in the main view, ensure that the
       `Runner` target is selected. You can verify this by exposing the
       sidebar using the [| ] icon in the upper-left corner of the main
       view.
    5. Select the *General* tab in the project settings. Under the
       *Embedded Binaries* section, click '+' to add `App.framework`. In the
       sheet that drops down, click the *Add Other...* button. Navigate to
       the `ios/Flutter` directory and select `App.framework`. Click *Open*.
       In the sheet that drops down, select *Create folder references*, then
       click *Finish*.
    6. In the project settings, verify that `App.framework` has been added to the
       *Embedded Binaries* and *Linked Frameworks and Libraries* lists.
    7. In the Xcode project navigator, drag `App.framework` under the
       Flutter folder.
    8. In the Xcode project navigator, select `Flutter` then from the
       *File* menu, select *Add Files to "Runner"...*. Navigate to the
       `ios/Flutter` directory, select `AppFrameworkInfo.plist` and click
       the *Add* button.
    9. From the command line, in your project directory, run
       `flutter build clean`, then `flutter run`.
    
    At this point your project should be fully migrated.
    0ee3f57a
Name
Last commit
Last update
..
android Loading commit data...
base Loading commit data...
commands Loading commit data...
dart Loading commit data...
fuchsia Loading commit data...
ios Loading commit data...
runner Loading commit data...
test Loading commit data...
application_package.dart Loading commit data...
artifacts.dart Loading commit data...
asset.dart Loading commit data...
build_info.dart Loading commit data...
cache.dart Loading commit data...
crash_reporting.dart Loading commit data...
dependency_checker.dart Loading commit data...
devfs.dart Loading commit data...
device.dart Loading commit data...
doctor.dart Loading commit data...
flx.dart Loading commit data...
globals.dart Loading commit data...
protocol_discovery.dart Loading commit data...
resident_runner.dart Loading commit data...
run_cold.dart Loading commit data...
run_hot.dart Loading commit data...
services.dart Loading commit data...
template.dart Loading commit data...
usage.dart Loading commit data...
version.dart Loading commit data...
vmservice.dart Loading commit data...
vmservice_record_replay.dart Loading commit data...
zip.dart Loading commit data...