我在将代码库从旧的英特尔 MacBook 迁移到较新的 m1 芯片 MacBook 时经历了一段痛苦的时光。我经历了很多困难,在删除所有 cocoapods 并切换到 swift 管理器后终于得到了可以编译的代码。
根据屏幕截图,现在我在 iPhone 模拟器中测试各种屏幕,我的 AppDelegate 文件中会弹出随机错误,这些错误没有任何意义,并且在我的英特尔 MacBook 上根本不是问题。我已经尝试了 100 次架构设置更改,但没有任何帮助。
仅供参考 - 我正在尽力让这一切在 Xcode 版本 15.0.1 上运行,因为我想在他们的最新平台上继续编写代码。
对于屏幕截图中的任何一个错误,我都会收到以下错误:
警告:模块“/usr/lib/system/libsystem_kernel.dylib”使用三元组“arm64-apple-macosx13.6.0”,与目标三元组“arm64-apple-ios16.0.0-simulator”不兼容。启用每个模块的 Swift 临时上下文。
错误 #1:线程 1:“*** -[NSConcreteTextStorage attributeAtIndex:longestEffectiveRange:inRange:]:范围或索引超出范围”
错误 #2:线程 1:“[
class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate {
var window: UIWindow?
let appId: String = "****"
let region: String = "us"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let mySettings = AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region: region).build()
CometChat.init(appId: appId ,appSettings: mySettings,onSuccess: { (isSuccess) in
if (isSuccess) {
print("CometChat Pro SDK intialise successfully.")
}
}) { (error) in
print("CometChat Pro SDK failed intialise with error: \(error.errorDescription)")
}
FirebaseApp.configure()
GMSPlacesClient.provideAPIKey("****")
UNUserNotificationCenter.current().delegate = self
application.registerForRemoteNotifications()
//UIApplication.shared.applicationIconBadgeNumber = 1
Messaging.messaging().delegate = self
let config = CheckoutConfig(
clientID: "****",
environment: .live
)
Checkout.set(config: config)
return true
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("Cannot register for notifications: \(error)")
}
要结束这个问题 - 我找到了两个解决方案:
重要的一点是取消选择调试可执行文件。