skip to Main Content

I am attempting to upload an app to TestFlight. The app compiles and runs in the simulator, and will also run on my iPhone if I install it direct from Xcode. If I archive and push it to TestFlight, then update my device from TestFlight, the app crashes when I attempt to view a specific view Controller.

I am using MessageKit (using Cocoapods, since this is an older project I am reviving), and the specific view Controller that crashes the app extends MessagesViewController. The error message that TestFlight kicks back to me reads:

"MessageKit: static UIColor.colorFromAssetBundle(named:)"

Perhaps the archiving process is skipping a bundle from Messagekit that Xcode will include locally?

Any references to an error like this on StackOverflow seem to be hyper specific:

iOS app runs fine if installed through Xcode, but crashes on one particular view controller when installed through TestFlight

and in the case of the above user, they just ended up re-writing the viewController (which for me would mean dropping and rewriting MessageKit).

I think this is an issue with the archiving process skipping files. Any thoughts on how to investigate if that is the case, or any suggestions on how to rectify this would be greatly appreciated. Thanks!

2

Answers


  1. Chosen as BEST ANSWER

    Solution: Coacopods was the issue. I was running the latest version of Messagekit that was published using cocaopods, which was over a year old. This meant that updating the pods was never going to work. I switched to swift package manager and have the up to date version of Messagekit, and everything is working! Thanks to everyone that reached out.

    Reference: https://github.com/MessageKit/MessageKit/issues/1537


  2. The following codes are available in the UIColor and Bundle extensions in MessageKit:

    UIColor+Extensions.swift

    private static func colorFromAssetBundle(named: String) -> UIColor {
        guard let color = UIColor(named: named, in: Bundle.messageKitAssetBundle, compatibleWith: nil) else {
            fatalError(MessageKitError.couldNotFindColorAsset)
        }
        return color
    }
    
    static var incomingMessageBackground: UIColor { colorFromAssetBundle(named: "incomingMessageBackground")  }
    

    Bundle+Extensions.swift

    internal extension Bundle {
        #if IS_SPM
        static var messageKitAssetBundle: Bundle = Bundle.module
        #else
        static var messageKitAssetBundle: Bundle {
            return Bundle(for: MessagesViewController.self)
        }
        #endif
    }
    

    Make sure you have the correct bundle for MessagesViewController here or
    Manually copy the assets files in MessageKit into the Project’s assets file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search