与从 Intel 迁移到 M1 芯片相关的 AppDelegate 文件的随机问题

问题描述 投票:0回答:1

我在将代码库从旧的英特尔 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:“[ setValue:forUndefinedKey:]:此类对于关键 dayOfMonth 不符合键值编码。”

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)")
}
ios swift xcode ios-simulator appdelegate
1个回答
0
投票

要结束这个问题 - 我找到了两个解决方案:

  1. CalendarCell 问题只是 IBOutlet 问题。当我重命名代码库时,我必须根据屏幕截图手动将数十个故事板更新到新模块,但一定错过了这一连接。令人烦恼的是,该错误没有指出实际错误所在!

  1. 我放弃了 xcode 15,回到了 xcode 14.2(我确信我正在使用的 swift 包不能与 15 一起工作)。在 14.2 上,我遇到了一个不同的错误,并通过此线程解决了 Xcode 14 未在调试模式下附加到模拟器

重要的一点是取消选择调试可执行文件。

© www.soinside.com 2019 - 2024. All rights reserved.