Home:ALL Converter>Flutter iOS App on an iOS Simulator running on an M1 Mac

Flutter iOS App on an iOS Simulator running on an M1 Mac

Ask Time:2021-03-31T19:17:55         Author:Jose

Json Formatter

Is there an issue with Flutter iOS apps on an iOS simulator (iPhone 12 Pro Max) running on an M1 Mac with Big Sur 11.2.2 and Flutter 1.22.6 ?

You see, my Flutter iOS app (using multiple Flutter plugins) was developed on an Intel-based Mac running Catalina (10.15.7) and Flutter 1.22.5 and it works, but when I moved to an M1 based Mac running Big Sur and Flutter 1.22.6, I’m having the Cocoapod’s error:

[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile.

Note that on this M1 mac, 'flutter doctor' is successful and I can create the Flutter test app and run it on an iOS simulator so I think its setup properly.

I have also tried the solutions suggested with past posts having this symptom to no avail. I have tried the following:

1- I uncommented the line 'platform :ios, '9.0'' in my pods file.

2- I ran the following CLI commands in the terminal:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
cd ios
pod install
cd ..
flutter build ios

The result of trying both suggestions above is the same 'Error running pod install' error with no other error messages mentioned.

The only thing I can think of at this point is that there is a problem with the Flutter plugins I am using when running in an iOS simulator on an M1. Again, these plugins work on an Intel-based Mac running Catalina. If so, unfortunately, the error doesn’t tell me which one. The plugins that I use are:

dependencies:
  flutter:
    sdk: flutter
  provider: ^4.1.3
  sqflite: ^1.3.2+1
  googleapis: ^0.56.1
  googleapis_auth: ^0.2.12
  http: ^0.12.2
  url_launcher: ^5.7.2
  flutter_secure_storage: ^3.3.5
  tuple: ^1.0.3
  image_picker: ^0.6.7+12
  intl: ^0.16.1
  fraction: ^1.2.1
  archive: ^2.0.13
  path_provider: ^1.6.24
  path: ^1.7.0
  image_cropper: ^1.3.1
  flutter_image_compress: ^0.7.0

All help / suggestions greatly appreciated.

Author:Jose,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/66886800/flutter-ios-app-on-an-ios-simulator-running-on-an-m1-mac
Ben Butterworth :

It's not yet supported (Coming in this PR)\nFlutter has disabled running on simulators running on ARM architecture. They've done this because a flutter dependency (iOS engine Flutter.framework) didn't have arm64 slices. There is an open pull request to add support for iOS simulator on M1 macs (arm64): https://github.com/flutter/flutter/pull/85059\nI initially tried to get this working for myself, but the issue is Generated.xcconfig contains code which disables arm64 architecture for the simulator, and this file is generated by Flutter internally. Once you manually change this, it still fails. If you tried to build with Xcode, you might get this error message during the linking process:\nUndefined symbol: _OBJC_CLASS_$_ClassName\n\nand lots more. I'd recommend building with Xcode if you don't see enough logs or information to debug the build process.\n\nAutomatically assigning platform is not an error\nAutomatically assigning platform iOS is not actually an error, it's just telling you its defaulted to iOS platform. It then failed, so in this case, you should've provided more error information.",
2021-06-24T15:58:14
yy