Unkown WKExtension Error

Hello Everyone,

Ever since the recent WatchOS 7 Beta 3 update, I've been receiving this message in the debugger:

2020-07-24 09:59:36.206127-0700 appName WatchKit Extension[297:20532] [default] +[WKExtension sharedExtension]:38: Extensionless WatchKit apps should use WKApplication

I created a new project (iOS app w/ WatchKit app) and received same output, which makes me think it is related to the recent Beta release. I am unsure about how this affects runtime, but this makes tracking print statements in the debugger really annoying.

I can't seem to find any information about this anywhere online, and was wondering if anyone has faced a similar issue.

Running XCode 12 Beta 3 on Apple Watch Series 4 (44mm, GPS) with WatchOS 7 Beta 3. The App is set to run independently of the companion iPhone app.

Thank you.

Yes, I have the same issue. My watchOS app has no iPhone companion app at all. Are you using SwiftUI? How do you declare you extension?

I have the ExtensionDelegate class name listed in the extension's Info.plist and then in the App:

Code Block
@main
struct MyWatchApp: App {
   @StateObject private var dataProvider = AppDataProvider.shared
   @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate

My other issue is that the extension delegate is launching background operations using URLSession, but these are not initiated. Trying to find out where I am doing wrong...

Perhaps this way of declaring/creating the extension delegate is not the right way with the new SwiftUI watch apps?
Yes, I am also using the SwiftUI life cycle and have an identical extension declaration to yours in both the App and Info.plist. I am quite certain that this is how you declare the extension delegate since the debugger will print an error if you try scheduling a background task without declaring it in this way. Perhaps we are missing a step.

On that note, I can't seem to schedule background tasks. My handle( ) method never receives a WKApplicationRefreshBackgroundTask after the following code block is called:
Code Block swift
func scheduleBackgroundUpdate() {
    let fireDate = Date(timeIntervalSinceNow: 10)
     
    print("\nActivityManager: Scheduled background process will run at: \(fireDate.description)\n")
     
    WKExtension.shared().scheduleBackgroundRefresh(withPreferredDate: fireDate, userInfo: nil)
    { (error) in
      if error == nil {
        print("\nWKExtension: Scheduled background process successfully.")
      }
      else {
        print("WKExtension: Could not schedule background process.")
      }
    }
  }

error always results in nil, indicating that it should work, but I never receive an event update. I do get event updates for applicationDidFinishLaunching and WKSnapshotRefreshBackgroundTask, however.

Do you have any idea why this might be?

Thank you.



I have the same problem. Initiating the scheduled background update in similar manner. See my other post here.

I do get calls to handle() but only to handle snapshots, not background tasks. If you look at the logs in my other post, I get

Code Block
workspace error 13:22:43.844990+0300 com.apple.Carousel Carousel com.mydomain.myapp.watchkitapp: app does not support BAR, not creating action for reason CSLSDuetActivationReasonComplication -- openApplicationOptions: { CSLSDuetActivationServiceReasons = ( CSLSDuetActivationReasonComplication ); "ActivateSuspended" = 1; "PayloadOptions" = { budgetdictionary = "/watch/budget/launches"; kCSLBackgroundActivityUUID = "A3368012-79B9-4170-9008-EA7D0A23651F"; kCSLBackgroundActivityUserString = "F4FE89A5-28A9-4F2D-A78E-B8F8B0263D1F"; };}

I tried adding background capability to the app but that didn't help.
Got it working, see the other thread. Unfortunately background ops worked only when not using SwiftUI App architecture. Maybe someone finds a way to make it work or future updates to watchOS 7 make it work also with SwiftUI App architecture.
I read thru the alternative thread... and seems that the problem is different but similar to mine.
Unkown WKExtension Error
 
 
Q