Skip to content

Conversation

@cbracken
Copy link
Member

@cbracken cbracken commented Mar 22, 2017

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. Download a copy of AppFrameworkInfo.plist and save it to the ios/Flutter directory of your project.
  9. 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.
  10. From the command line, in your project directory, run flutter build clean, then flutter run.

The final state of your project should appear as follows:
configuration

At this point your project should be fully migrated.

@cbracken
Copy link
Member Author

Fixes #8075

@cbracken cbracken requested review from chinmaygarde and xster March 22, 2017 23:31
Copy link
Member

@xster xster left a 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?

@cbracken cbracken changed the title Build a framework rather than a raw dylib on iOS Build Flutter app as a framework on iOS Mar 22, 2017
@cbracken cbracken merged commit 0ee3f57 into flutter:master Mar 23, 2017
@cbracken cbracken deleted the ios-framework-not-dylib branch March 23, 2017 00:41
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants