Random Issues with AppDelegate File related to move from Intel to M1 Chip

143 Views Asked by At

I've been having a hell of a time moving a code base from an old intel macbook to a newer m1 chip macbook. I've jumped through many hoops and finally got the code to compile after removing all cocoapods and switching to swift manager.

Per screenshots, now that I'm in the iphone simulator and testing out various screens, I'm having random bugs pop up in my AppDelegate file that just don't make any sense and were not an issue on my intel macbook at all. I've tried a 100 architecture setting changes and nothing is helping.

FYI - I'm trying my best to get this all working on Xcode version 15.0.1 as I'd like to code going forward on their latest platform.

I get this below error for either of the errors I have in the screenshots:

warning: Module "/usr/lib/system/libsystem_kernel.dylib" uses triple "arm64-apple-macosx13.6.0", which is not compatible with the target triple "arm64-apple-ios16.0.0-simulator". Enabling per-module Swift scratch context.

Error #1: Thread 1: “*** -[NSConcreteTextStorage attributesAtIndex:longestEffectiveRange:inRange:]: Range or index out of bounds”

Error #2: Thread 1: “[<UICollectionViewCell 0x10b3b6e40> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dayOfMonth.”

enter image description hereenter image description here

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)")
}
1

There are 1 best solutions below

0
Senator On

To close this out - I found two solutions:

  1. The CalendarCell issue was just an IBOutlet issue. When I renamed the codebase, I had to do manually update dozens of storyboards to the new module per screenshot but must have missed this one connection. It's annoying the error doesn't point you to where the actual error is!

enter image description here

  1. I gave up on xcode 15 and went back to xcode 14.2 (I'm convinced the swift package i'm using can't work with 15). On 14.2 I had a different error and it was solved by this thread Xcode 14 is not getting attached to Simulator in Debug mode.

The important takeaway was deselecting debug executable.

enter image description here