Start Workout intent does not pass userInfo to parent app via user activity

Originator:atlantiasoftware
Number:rdar://27316402 Date Originated:12-Jul-2016 11:49 PM
Status:Open Resolved:
Product:iOS SDK Product Version:10 beta 2
Classification:Serious Bug Reproducible:Always
 
Summary:
When handling a start workout intent by returning a “continueInApp” result and passing an NSUserActivity, the user activity handed to the parent app’s application delegate loses the userInfo and title set in the intent extension.

Extension:

    func handle(startWorkout startWorkoutIntent: INStartWorkoutIntent, completion: (INStartWorkoutIntentResponse) -> Void) {
        // Implement your application logic to start a workout here.
        
        // Update application state by updating NSUserActivity.
        let userActivity = NSUserActivity(activityType: NSStringFromClass(INStartWorkoutIntent.self))
        if let name = startWorkoutIntent.workoutName?.identifier {
            userActivity.title = startWorkoutIntent.workoutName?.identifier
            userActivity.userInfo = [ "name": name ]
        }
        let response = INStartWorkoutIntentResponse(code: .continueInApp, userActivity: userActivity)
        completion(response)
    }

Main App:

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
        let type = userActivity.activityType
        if let name = userActivity.userInfo?["name"] as? String where type == NSStringFromClass(INStartWorkoutIntent.self) {
            // NEVER CALLED - userInfo is not carried over
            let alert = UIAlertController(title: "User Activity", message: "Continue Activity: \(name)", preferredStyle: .alert)
            window?.rootViewController?.present(alert, animated: true, completion: nil)
        }

        return true
    }


Steps to Reproduce:
See attached Xcode project for report. 

Expected Results:
userInfo and title set on NSUserActivity in intent extension should be carried over to the main app. 

Actual Results:
userInfo and title are lost.

Comments

i faced the same issue

By gianfilippo.cisternino at July 18, 2016, 3:53 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!