Search code examples
objective-cswiftwatchkitapple-watchwatchos-2

Creating Extension Delegate class for Watch OS2


I recently upgraded my existing watch OS app to watch OS 2. I noticed there was no Extension Delegate class so I tried creating it myself.

Here are the steps I've taken.

Created a Swift file called ExtensionDelegate.swift

    import WatchKit

class ExtensionDelegate: NSObject, WKExtensionDelegate{
    func applicationDidFinishLaunching() {
        NSLog("test");
    }

    func applicationDidBecomeActive() {


    }



    func applicationWillResignActive() {


    }
}

I added the following to my Watchkit extension Info.plist "WKExtensionDelegateClassName" with a value of "ExtensionDelegate"

However, I cannot hit the breakpoint in my applicationDidFinishLaunching() delegate method.

What am I missing?


Solution

  • It turns out I had to use the following value for WKExtensionDelegateClassName

    $(PRODUCT_MODULE_NAME).ExtensionDelegate