“This is the first day of my participation in the Gwen Challenge in November. See details of the event: The last Gwen Challenge in 2021”.

Recently, I changed my office to Mac Mini (M1, 2020), and encountered some problems after upgrading the system and installing the new Xcode. Please record it.

1. IOS projects don’t work.

1.1 Project compilation failed

Two major maintenance projects encountered a build error:

ld: warning: ignoring file /Users/xxx/Library/Developer/Xcode/DerivedData/FFer-Client-blhojnexdkcciegjsxqvplzhfump/Build/Products/Debug-iphonesimul ator/AFNetworking/libAFNetworking.a, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64 ld: warning: ignoring file /Users/xxx/Library/Developer/Xcode/DerivedData/FFer-Client-blhojnexdkcciegjsxqvplzhfump/Build/Products/Debug-iphonesimul ator/AliyunOSSiOS/libAliyunOSSiOS.a, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64 ... There are many other similar third-party library link problem information object file (/Users/xxx/Projects/FFer-Client/Pods/OneKit/OneKit/BaseKit/Decorator/Vendor/libEncryptor.a(libBDEncryptor-iOS.a-x86_64- Master.o) was built for newer iOS Simulator version (10.3) than being Linked (10.0) ld: Warning: object file (/Users/xxx/Projects/FFer-Client/Pods/TXLiteAVSDK_Player/TXLiteAVSDK_Player/SDK/TXLiteAVSDK_Player.framework/TXLiteAVSDK _Player(libvoicechanger. O)) was built for newer iOS Simulator version (13.2) than being Linked (10.0) ld: Warning: object file (/Users/xxx/Projects/FFer-Client/Pods/TXLiteAVSDK_Player/TXLiteAVSDK_Player/SDK/TXLiteAVSDK_Player.framework/TXLiteAVSDK _Player(trae_voip.o) was built for newer iOS Simulator Version (13.2) than being linked (10.0)... Undefined symbols for Architecture x86_64 project... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Undefined symbol: _OBJC_CLASS_$_SDWebImageDownloader Undefined symbol: _OBJC_CLASS_$_AFHTTPRequestSerializer Undefined symbol: _AFQueryStringFromParameters Undefined symbol: _OBJC_CLASS_$_WYPopoverController Undefined symbol: _AFNetworkingTaskDidSuspendNotification Undefined symbol: _AFNetworkingTaskDidResumeNotification ...Copy the code

You can see it’s related to the chip architecture, and it’s all in library 3. The third party libraries are all built for the old X86_64 architecture and are now linked to the new ARM64 emulator. Do a keyword search and finally compile all schemas by adding configuration to your Podfile:

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| # Address the issue that emulators are not supported on M1 chips: compile not only active architectures, but i386, X86_64, ARM64, etc. config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' end end endCopy the code

Delete the VALID_ARCHS in Project/TARGETS custom Building Settings. This has no effect. More program reference: mirari.cc/2021/07/28/…

1.2 Project package link failed

ld: building for iOS Simulator, but linking in object file built for iOS, file '/Users/xxx/Pods/mob_sharesdk/ShareSDK/ShareSDK.framework/ShareSDK' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Copy the code

Similar to the previous problem, the linked file is arm64 architecture, the solution is to add configuration items in the TARGETS > Build Settings > Architectures > Excluded Architectures: Any iOS Simulator SDK: arm64 The ARM64 architecture is not included for emulators. (Later verified that the solution to the previous problem can also solve the problem, summarized as VALID_ARCHS and Excluded Architectures should not contradict each other)

Reference: StackOverflow: Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture ‘arm64’

2. The UI is abnormal.

Same code, running iOS 15 emulator with Xocde 13 found some UI exceptions.

2.1 Table View Header/Footer extra height (22pt)

The sectionHeaderTopPadding property was added in iOS 15.

/// Padding above each section header. The default value is `UITableViewAutomaticDimension`. @property (nonatomic) CGFloat sectionHeaderTopPadding API_AVAILABLE(ios(15.0), TVOs (15.0), Watchos (8.0));Copy the code

The default value is UITableViewAutomaticDimension, don’t know why will be set to 22, the document without further explanation, the solution manual configuration of 0:

if (@available(iOS 15, *)) {
	  _imChatListVC.tableView.sectionHeaderTopPadding = 0;
}
Copy the code

2.2 The navigation bar becomes transparent by default

Solve the problem by configuring the navigation bar style:

- (void) configNavigationAppearance {the if (@ the available (iOS 13.0, *)) { UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc] init]; [apperance configureWithOpaqueBackground]; [[UINavigationBar appearance] setStandardAppearance:apperance]; [[UINavigationBar appearance] setScrollEdgeAppearance:apperance]; }} /*  <https://developer.apple.com/documentation/uikit/uinavigationbar/3198028-standardappearance> */ /// Describes the appearance attributes for the navigation bar to use when it is displayed with its standard height. @property (nonatomic, Readwrite, copy) UINavigationBarAppearance * standardAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE (ios (13.0), Tvos (13.0)); /// Describes the appearance attributes for the navigation bar to use when it is displayed with its compact height. If not set, the standardAppearance will be used instead. @property (nonatomic, readwrite, copy, Nullable) UINavigationBarAppearance * compactAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE (ios (13.0)); /// Describes the appearance attributes for the navigation bar to use when an associated UIScrollView has reached the edge abutting the bar (the top edge for the navigation bar). If not set, a modified standardAppearance will be used instead. @property (nonatomic, readwrite, copy, Nullable) UINavigationBarAppearance * scrollEdgeAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE (ios (13.0)); /// Describes the appearance attributes for the navigation bar to use when it is displayed with its compact heights, and an associated UIScrollView has reached the edge abutting the bar. If not set, first the scrollEdgeAppearance will be tried, and if that is nil then compactAppearance followed by a modified standardAppearance. @property(nonatomic,readwrite, Copy, nullable) UINavigationBarAppearance * compactScrollEdgeAppearance UI_APPEARANCE_SELECTOR API_AVAILABLE (ios (15.0));Copy the code

As you can see from the documentation, iOS 13 can be configured from the start with standard height, compact mode (which is supposed to show the status of a small line of title when the navigation bar is jacked up), and style properties for scrolling views under the navigation bar. IOS 15 has added a new style for the compact mode scroll view near the edge of the navigation bar, probably tweaking the default behavior along the way.

Reference: StackOverflow: iOS 15 Navigation Bar Transparent

3. It cannot be opened without software supporting M1 chip

For example, Evernote 9.5.12:

Click Install, enter your password, however:

After the search attempt, finally through switching network solution (Apple if can clear prompt ‘An network error has occurred.. ‘better yet). There was also talk of trying to reboot.

Good luck.