I am curious, has anybody managed to get SwiftUI’s .onContinueUserActivity working? Wanting on the pattern code from Apple, it appears to be working of their app (observe the testing directions within the ReadMe file). However once I arrange a brand new mission for myself and attempt to reproduce it, I can not get it to work.
Mine is only a vanilla SwiftUI mission with the next modifications:
- Within the data.plist, I’ve outlined:
<key>NSUserActivityTypes</key>
<array>
<string>com.instance.RnD.customActivity</string>
</array>
- This is my app definition:
@principal
struct UserActivityDemoApp: App {
static let customActivityType = "com.instance.RnD.customActivity"
var physique: some Scene {
WindowGroup {
ContentView()
.userActivity(Self.customActivityType, isActive: true) { exercise in
exercise.title = "Doing Customized Exercise"
exercise.isEligibleForSearch = true
exercise.isEligibleForHandoff = true
exercise.becomeCurrent()
print("Defining person exercise")
}
.onContinueUserActivity(Self.customActivityType) { exercise in
print("we should always resume (exercise.title ?? "misconfigured exercise")")
}
}
}
}
I’d suppose this ought to be sufficient to get the “we should always resume …” message printed, however it is not working. Is there one thing extra I have to do within the .userActivity
block? Apple’s docs appear to recommend that I’ve accomplished sufficient.