Optimization of (not only) projects on the Apple Silicon platform
This guide deals not only with the optimization of Xcode projects and the setting of its individual parameters but also with the problems that you can commonly encounter when working with the latest laptops with the Apple M1 chip.
The sudden display of the screen saver
This is an interesting bug that occurs to a greater extent, especially on devices with this processor. The problem is that during normal operation, the screen saver suddenly appears after a while and cannot be turned off.
One solution is to close and reopen the laptop to turn off this screen saver. However, a thread has been created on the Apple Developer Forums that instructs users to turn off the display of the quick switch menu between users in the system settings.
The display of the menu for quick switching between users can be found in the settings:
System Preferences ➡️ Users & Groups ➡️ Login Options
Inoperative CocoaPods in the terminal
CocoaPods supports Apple Silicon from version 1.10.0+, but if you still encounter the problem you have 2 possible solutions:
1. Install the Ruby-FFI support package. Just enter the terminal command:
sudo gem install ffi
2. Launch the terminal under Rosetta. All you have to do is display the info above the terminal, click on the opening under Rosetta, and restart the terminal.
The project cannot be run on the simulator
The simulator is now running on macOS Big Sur on arm64, which means that the project is also compiled using a new set of instructions, and the majority of large libraries, especially from Google, are not yet optimized.
One of the temporary solutions to run such a project is not to support compiling the project on a simulator into an arm64 architecture. To turn it off, you need to set the exclusion of this architecture in the project settings for the simulator.
If the project also contains external libraries that are included in the project via the CocoaPods package dependency manager, it is necessary to set up such architecture exclusion for Pods.xcproject as well. We can do this very easily, just place a script in the Podfile file that sets the required exclusion of this architecture for each pod.
post_install do |installer_representation| installer_representation.pods_project.targets.each do |target| target.build_configurations.eachdo|config| config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end end
It is not possible to scroll continuously in the simulator
If the scroll stops immediately after releasing the cursor while scrolling over UIScrollView, then there is a problem with the new architecture of the simulator.
Developers are also discussing this issue at the Apple Developer Forums, causing the arm64 architecture to cease to exist in the project. To eliminate the problem, it is necessary, as with the problem with the terminal, to run the simulator under Rosetta.
The simulator application can be found in the folder:
Xcode ➡️ Show Package Contents ➡️ Contents ➡️ Developer ➡️ Applications ➡️ Simulator
The project cannot be started because it displays the error ‘FIRAnalyticsConnector 'for architecture arm64’
The problem is known and is caused by incorrect linking of the library through the CocoaPods package dependency manager. This issue should be fixed in version 1.10.1, which is already available for download.
pod 'Firebase/Analytics', '7.4-M1' pod 'Firebase/Core', '7.4-M1' pod 'Firebase/Crashlytis', '7.4-M1' pod 'Firebase/Performance', '7.4-M1'
The general status of this problem can be traced to the following issue on the Github.
If you do not want to miss the latest news from our world, sign up for our newsletter.