iOS Simulator scrolls too fast on Apple M1
Asked Answered
S

5

61

I'm running a flutter project and when dragging any list or scroll view on the simulator, it scrolls with way too much force rendering almost impossible to get to the row I need.

This only happens in the simulator, and it seems to work fine on a real device. Also, this problem started when I had migrated to an Apple M1 MacBook Pro.

Drag is minimal

Any ideas?

Simonides answered 28/12, 2020 at 10:19 Comment(3)
if your problem is not in a device or creating a jank in performance i can't see a problem here, probably you computer process way faster that an iPhone. just verify you performance is ok and that should be good enough.Useless
Of course, it is a problem! It essentially makes the simulator useless for developing any app with a list.Angy
recently I faced the same issue, it seems it was because one of the native plugins has arm64 in Excluded Architectures setting. Removing arm64 from this setting (keeping only i386) and wiping all data from simulator solved the issue. Abviously that it depends on plugin itself, some of them suffer from wrong binary usage on M1 chip simulatorsAlerion
D
82

I experienced a similar issue but the problem, in my case, is not related to speed but something different.

Specifically, if you force your iOS Simulator to run under Rosetta you'll see that it works as expected. Not sure why, but this is what I'm experiencing. Always reproducible with 1.22.5 (stable).

To run in Rosetta, right click on Xcode and choose "Show Package Contents", from there you navigate to "Contents > Developer > Applications," There you'll find the Simulator app. If you right click on it and choose "Get Info", you'll find an option to run it using Rosetta.

Update 14/9/2021: Xcode 12.5.1 no longer needs the above workaround. Scrolling is working fine out-of-the-box.

Update 29/10/2023: Xcode 15.x and possible other versions in the past, unfortunately seems to suffer again of the infamous bug above.

I found that running Simulator with x86_64 emulation on Ventura, Sonoma as follow:

arch -x86_64 /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator

workaround the problem.

Ditzel answered 30/12, 2020 at 17:26 Comment(16)
This did help with a similar issue, where the scrolling was "laggy"/"stuttering". Thank you very much!Fourgon
Fixed this very frustrating issue. Thanks, @valvoline!Scaremonger
This will make the simulator laggy on heavy apps though; performance won't be as good.Coffeehouse
I'm using Xcode 13.1 on a M1 Pro and was still having this issue. Forcing the simulator to run under Rosetta fixed it. The M1 has been available for over a year, not sure why we're still dealing with these kind of bugs.Preset
works thanks! ..Waldack
This works! However, I would remove the update about it working with Xcode 12.5.1. I'm on 13.2 and it is still broken.Stepheniestephens
Still seeing the same "super-fast scrolling" in the simulator: Flutter 2.8.1, MacBook Pro 16" with M1 Max, macOS Monterey 12.1, Xcode 13.2.1. Running the simulator with Rosetta fixed it.Chlamydospore
I am using Xcode 13.2.1 but it doesn't work out of the box. However the Rosetta fix works. Any idea why the issue is still there?Travail
I have this problem with an old project. Running simulator with Rosetta enabled fixed it!Deferment
This didn't become a problem for me (on my new M1) until I added the "Google Maps API for iOS" to my app. Enabling Rosetta for the Simulator is a viable workaround but I'm still looking for a solution. Running Xcode 13.4.Uneventful
I'd updated my XCode last weekend, this problem persist and was fixed using the workaround of activating RosettaLikely
The iOS 16 emulator has no "Rosetta" option any more. But today I found out that the problem was caused by a single plugin that had "'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'" in its podspec file. Replacing it with "s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }" as in a new empty Flutter Plugin fixed the scrolling problem.Psychosurgery
The scrolling bug still persists and there's no option to run the Simulator app using Rosetta anymore and the issue filed on the official Flutter repository has been closed. XCode version is 14.0.Crackling
Still scrolling bug exists. XCode version 14.2.Preposition
Bug still exists in iOS 17.0.Alaster
that's sad, I also face this with iOS 17.0 and XCode 15.0.1. Anyone with with a solutionTansy
M
33

[2023 Solution]

Just need to using x86_64 Simulator. Follow these step on Terminal after close Simulator

1. Get list device ID:
xcrun simctl list

2. Launch:
xcrun simctl boot [deviceID] --arch=x86_64

Ex:
xcrun simctl boot 2BDDB447-AA8D-4BD4-8BFA-2F54363C2235 --arch=x86_64

Sometime Simulator will not automatic launch so you need to open it manually after step 2

Mernamero answered 12/4, 2023 at 9:8 Comment(9)
This worked, it took a long time to run but is working. Not a perfect solution but a solution.Baillieu
Finally, this works!!Williamson
I had another issue with the swipe scrolling abruptly stopping instead of getting a smooth scroll when I released the swipe gesture. This fixed it.Gibbet
is there a way to automate this or have it always open with the x86_64 arch?Gibbet
This works! It should be the accepted answer.Irresistible
Not working on XCode 15. Anyone found a solution ?Tansy
@Tansy I'm using xcode 15 rn and it still goodMernamero
works for ios 15.2 xcode 15.2 Macmini m1 sonoma 17-1-2024Abyssal
This solution works perfectly fine, running it on Mackbook Pro M3 Pro (Sonoma 14.4), Xcode 15.3, iOS 17.4Steinman
M
10

[2022 update] The accepted answer no longer works, as there is no option in the iOS Simulator's Get Info dialog to run with Rotessa. Instead, what you can do is launch the iOS Simulator from Terminal using the following command:

arch -x86_64 /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
Marchellemarcher answered 4/10, 2022 at 14:14 Comment(4)
Gets exactly the same result. Still scrolling fast.Burchfield
This answer did not work for me. I am using M1 MbPro, XCode 14.2Erg
It doesn't work at all.Preposition
Not working on XCode 15. Anyone found a solution ?Tansy
S
3

With me, this suddenly came up again with XCode 14/iOS 16. Fixed it in the ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386"
    end
  end
end

Remove arm64, so change the line to:

      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386"
Scowl answered 26/10, 2022 at 7:34 Comment(1)
Sadly, this doesn't help me, as I receive such error instead: error: the following command failed with exit code 0 but produced no further output GenerateDSYMFile (...) for one of my Flutter pluginsPutput
S
1

Jank is completely gone once you run the app while targetting arm64.

DO NOT DO THAT IF YOUR DEPENDENCIES CONTAIN NATIVE BINARIES One such example is google_maps_flutter, they don't provide arm64 binaries and as such, attempting to compile the project on M1 natively will result in errors.

Open app's ios folder in xcode, click on Runner and edit Build Settings so that Architectures points to arm64 and Excluded Architectures doesn't contain arm64 how it should look like (more or less)

(even though these gifs are only 10 seconds long, they are over 2MB and can't be embedded, sorry for that)

Serotherapy answered 22/1, 2022 at 14:34 Comment(2)
This means that if my app is using such dependencies, I'm left with no option at all? Awesome.Crackling
You can clone the library and edit the podspec in such a way that will make it possible for it to run on ARM, but that's quite a lot of hassle github.com/flutter/plugins/blob/main/packages/…Serotherapy

© 2022 - 2024 — McMap. All rights reserved.