Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of supporting Xcode10 and adapting to iPhoneXSMax and iPhoneXR

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge about "what is the method to support Xcode10 and adapt iPhone XSMax and iPhone XR". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. Third-party library compilation error

If Mixpanel-swift and SwiftLint are used in the project, these two will report errors on Xcode10. At present, the author has submitted new versions 2.4.5 and 0.27.0 respectively. After updating, the error can be solved.

2.library not found for - lstdc++.6.0.9

Pod project will be compiled after the main project, if you rely on libstdc++.tbd and libstdc++.6.0.9.tbd, this error will be reported, because Apple removed libstdc++ library in XCode10 and iOS12, replaced by libc++ library, Apple's explanation is libstdc++ has been marked as obsolete for 5 years, it is recommended that you use llvm optimized and fully support C++11 libc ++ library.

The temporary solution is to import the file libstdc++.6.0.9.tbd into Xcode10 and place it in the following directories/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/ and/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/respectively.

But this is only a temporary solution. If your own business module uses libstdc++, readjust the module code to rely on libc++, then recheck for problems and recompile. If the sdk provided by the third-party vendor you cite relies on libstdc++, contact the vendor and ask for an upgrade.

3.Enum case '... ' not found in type '... '

Solve the above two errors, and the error will also be displayed when compiling the program. The specific scenario is as follows:

PosVisitQuestionType: String { case text case textArea = "text_area" case dropDownList = "drop_down_list" case radioButton = "radio_button"}let type: PosVisitQuestionType!... switch type {case .text, .textArea: errorText = NSLocalizedString("Please enter the following options", comment: "")case .dropDownList, .radioButton: errorText = NSLocalizedString("Click the right button to get current location", comment: "")default: break}

Xcode10 suggests adding "?" to each case. "

The reason may be that type is optional, so each case should be consistent with the type, so the prompt adds "? This may be due to the Xcode10 compiler update.

The way to modify it is to make sure that type will be assigned, then put "! "Remove, if you are not sure whether type has a value, follow the Xcode prompt to modify.

4. iPhone XS Max, iPhone XR

Our project uses DeviceKit, a third-party library, to obtain information such as models, so it needs to be updated to obtain information about new models. The latest version is 1.8.1. In the latest version, there's this variable

/// All Face ID Capable Devices static public var allFaceIDCapableDevices: [Device] { return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr] }

Since the navigationBar height and tabBar height of iPhone X, iPhone XS, iPhone XS Max and iPhone XR are the same, you can use allFaceIDCapableDevices to determine whether the current device has "Qi Liu Hai".

Examples:

static let faceIDDeviceArray = Device.allFaceIDCapableDevicesstatic let navigationHeight: CGFloat = { if faceIDDeviceArray.contains(currentDevice) { return faceIDDeviceNavHeight } else { return ordinaryDeviceNavHeight } }()

DeviceKit also provides such a method, which is called when running the simulator and returns the real device name.

/// Get the real device from a device. If the device is a an iPhone8Plus simulator this function returns .iPhone8Plus (the real device). /// If the parameter is a real device, this function returns just that passed parameter. /// /// - parameter device: A device. /// /// - returns: the underlying device If the `device` is a `simulator`, /// otherwise return the `device`. public static func realDevice(from device: DeviceKit.Device) -> DeviceKit.Device

Examples:

static let currentDevice = Device.realDevice(from: Device())if currentDevice == .iPhoneX {}//instead of if Device() == .iPhoneX|| Device() == .simulator(.iPhoneX) {}

Finally, don't forget to cut two more startup pictures, because iPhone XS and size are the same as iPhone X, so iPhone XS can be ignored.

iPhone XR:828px x 1792px

iPhone XS Max: 1242px x 2688px

"What is the method to support Xcode10 and adapt iPhone XSMax and iPhone XR?" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 220

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report