Not able to add .watchface file in xcode project

71 views Asked by At

This is the screenshot of the error view

func setUpPhoneCommunication() {
        if WCSession.isSupported() { // check if the device support to handle an Apple Watch
            let session = WCSession.default
            session.delegate = self
            session.activate()
            guard let url = Bundle.main.url(forResource: "Simple (1)", withExtension: "watchface") else {
                fatalError("*** Unable to find My.watchface in the app bundle ***")
            }
            if #available(iOS 14.0, *) {
                let library = CLKWatchFaceLibrary()
                library.addWatchFace(at: url) { (error) in
                    // Check for errors here.
                    if let error = error {
                        fatalError("*** An error occurred: \(error.localizedDescription) ***")
                    }
                }
            }
        }
    }

I have created .watchface file and added it to my Xcode project. I am using the above code to the file to my app when it launches, but I'm getting an error which I added in the screenshot.

0

There are 0 answers