Mixed configuration can refer to this article www.jianshu.com/p/eee692736…

I have recently started trying to use Flutter development in the edge module of the project, and have documented some of the problems encountered in the process of mixing.

1. Use Cocoapods

Add notice in debug. xcconfig and release. xcconfig that FlutterMixed is the name of your iOS project

#include "Pods/Target Support Files/Pods-FlutterMixed/Pods-FlutterMixed.debug.xcconfig"
#include "Pods/Target Support Files/Pods-FlutterMixed/Pods-FlutterMixed.release.xcconfig"
Copy the code

2. Failed to find FLUTTER_ROOT

Manually add file directories to your project

open Project Target and add User-Defined Setting with key name FLUTTER_ROOTwith the value of your flutter SDK location.

3, The path lib/main.dart does not exist

Config file’s.. /.. / Path problem

4, dyld: Library not the loaded: @ rpath/Flutter. The framework/Flutter

5. Debug Indicates a black screen

Remove App framework

6, Flutter doctor, Flutter upgrade, etc

Hang a terminal ss

exportHttp_proxy = http://127.0.0.1:1087;exportHttps_proxy = http://127.0.0.1:1087;Copy the code

Ports may not be the same, modify according to your OWN SS configuration

Xcode is stuck running script

Run the Flutter application once with Android Studio

8, ios-style AppBar

return new Scaffold(        
        appBar: new CupertinoNavigationBar(
          middle: new Text('test'),
          trailing: Material(child: IconButton(icon: Icon(Icons.settings))),      
        ),

        body: Text('test'));Copy the code

The release package does not load image resources

1. Update the Flutter version

flutter upgrade
Copy the code

2. Delete app. framework and Flutter. Framework files in the native project and add them again

Note: Flutter moved the contents of the Flutter_assets folder into app. framework in version 1.2. There is no need to add the Flutter_assets file to the native project

Error: Uploading App Store contains [x86_64]

App Store Connect Operation Error
ERROR ITMS-90087: "Unsupported Architectures. The executable for LoanCalculator.app/Frameworks/Flutter.framework contains unsupported architectures '[x86_64]'."

App Store Connect Operation Error
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'LoanCalculator.app/Frameworks/Flutter.framework/Flutter' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

App Store Connect Operation Error
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."
Copy the code

The solution

1. Open the terminal

2. CD to the Flutter. Framework folder

example : cd /Users/MAC/Desktop/Flutter/Flutter.framework
Copy the code

3. Execute the following code

lipo -remove x86_64 Flutter -o Flutter
Copy the code

4. Reopen the Clean, Build & Run and Create Archive projects

ps:

At present, there are only a few attempts to write with Flutter. The problems encountered are just the above, and the pits will be added in the future. Personally, I am very optimistic about Flutter technology, but in terms of current user experience, I feel that there is still a big gap between Flutter and iOS native. It makes iOS feel like Android, which is not good. I hope it will be improved in the future.