{"action":"created","issue":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/117","labels_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/117/comments","events_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/117/events","html_url":"https://github.com/ResearchKit/ResearchKit/issues/117","id":71384822,"number":117,"title":"Active task exiting after step 3","user":{"login":"pecampbell","id":5991929,"avatar_url":"https://avatars.githubusercontent.com/u/5991929?v=3","gravatar_id":"","url":"https://api.github.com/users/pecampbell","html_url":"https://github.com/pecampbell","followers_url":"https://api.github.com/users/pecampbell/followers","following_url":"https://api.github.com/users/pecampbell/following{/other_user}","gists_url":"https://api.github.com/users/pecampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/pecampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pecampbell/subscriptions","organizations_url":"https://api.github.com/users/pecampbell/orgs","repos_url":"https://api.github.com/users/pecampbell/repos","events_url":"https://api.github.com/users/pecampbell/events{/privacy}","received_events_url":"https://api.github.com/users/pecampbell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-27T19:56:16Z","updated_at":"2015-04-28T17:08:58Z","closed_at":null,"body":"I am testing the use of active tasks with something like this:\r\n\r\nlet fitnessTask = ORKOrderedTask.fitnessCheckTaskWithIdentifier(\"fitness\", intendedUseDescription: \"description\", walkDuration: NSTimeInterval(360), restDuration: NSTimeInterval(60), options: ORKPredefinedTaskOption.None)\r\nlet taskViewController = ORKTaskViewController(task: fitnessTask, taskRunUUID: nil)\r\ntaskViewController.delegate = self\r\npresentViewController(taskViewController, animated: true, completion: nil)\r\n\r\nAfter reaching step 3 where there is a countdown to the start of the activity, I hear the audio instructions saying \"after six minutes ...\". The app then returns to the screen where the app was launched from, effectively exiting the ResearchKit flow of screens.\r\n\r\nI am using the emulator that comes with xcode. These messages are written to the console:\r\n2015-04-27 14:14:42.531 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3cc7ca0>\r\n\r\n2015-04-27 14:14:42.535 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKInstructionStepViewController: 0x7f84e3cc7ca0>\r\n\r\n2015-04-27 14:14:42.536 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3cc7ca0>\r\n\r\n2015-04-27 14:14:43.570 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3da0300>\r\n\r\n2015-04-27 14:14:43.594 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKInstructionStepViewController: 0x7f84e3da0300>\r\n\r\n2015-04-27 14:14:43.878 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3da0300>\r\n\r\n2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKTaskViewController startAudioPromptSessionWithError:] 570 *** Started audio session\r\n\r\n2015-04-27 14:14:44.257 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke_2 466 Requesting health access\r\n\r\n2015-04-27 14:14:44.260 body-atlas[24728:790259] __82-[ORKTaskViewController requestHealthStoreAccessWithReadTypes:writeTypes:handler:]_block_invoke 365 Health access: error=Error Domain=com.apple.healthkit Code=4 \"Missing com.apple.developer.healthkit entitlement.\" UserInfo=0x7f84e3cd1840 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}\r\n\r\n2015-04-27 14:14:44.260 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke382 479 Requesting pedometer access\r\n\r\n2015-04-27 14:14:44.263 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke406 509 Requesting location access\r\n\r\n2015-04-27 14:14:44.265 body-atlas[24728:789974] -[ORKTaskViewController startAudioPromptSessionWithError:] 570 *** Started audio session\r\n\r\n2015-04-27 14:14:44.266 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.272 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.294 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.294 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillAppear:] 147 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.578 body-atlas[24728:789974] -[ORKActiveStepViewController viewDidAppear:] 155 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.579 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:44.582 body-atlas[24728:789974] -[ORKActiveStepViewController start] 304 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:49.625 body-atlas[24728:789974] -[ORKActiveStepViewController finish] 358 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:49.626 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.626 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.627 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.630 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillAppear:] 147 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillDisappear:] 170 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:49.656 body-atlas[24728:789974] -[ORKActiveStepViewController suspend] 333 <ORKCountdownStepViewController: 0x7f84e3fb84f0>\r\n\r\n2015-04-27 14:14:49.938 body-atlas[24728:789974] -[ORKActiveStepViewController viewDidAppear:] 155 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.938 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.942 body-atlas[24728:789974] -[ORKActiveStepViewController start] 304 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.944 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillDisappear:] 170 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\n2015-04-27 14:14:49.944 body-atlas[24728:789974] -[ORKActiveStepViewController suspend] 333 <ORKFitnessStepViewController: 0x7f84e3de9af0>\r\n\r\nI am using swift with the latest version of xcode. Also when I deploy this app to an actual iPhone, the same thing occurs - it also exits after step 3.\r\n\r\nThanks in advance for your help.\r\n"},"comment":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/comments/97139980","html_url":"https://github.com/ResearchKit/ResearchKit/issues/117#issuecomment-97139980","issue_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/117","id":97139980,"user":{"login":"jwe-apple","id":11575859,"avatar_url":"https://avatars.githubusercontent.com/u/11575859?v=3","gravatar_id":"","url":"https://api.github.com/users/jwe-apple","html_url":"https://github.com/jwe-apple","followers_url":"https://api.github.com/users/jwe-apple/followers","following_url":"https://api.github.com/users/jwe-apple/following{/other_user}","gists_url":"https://api.github.com/users/jwe-apple/gists{/gist_id}","starred_url":"https://api.github.com/users/jwe-apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwe-apple/subscriptions","organizations_url":"https://api.github.com/users/jwe-apple/orgs","repos_url":"https://api.github.com/users/jwe-apple/repos","events_url":"https://api.github.com/users/jwe-apple/events{/privacy}","received_events_url":"https://api.github.com/users/jwe-apple/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T17:08:58Z","updated_at":"2015-04-28T17:08:58Z","body":"Two ways to get your own UI. If you still want the default header view, then subclass active step view controller and supply your own step view. See any of the subclass of ORKActiveStepViewController for an example.\r\n\r\nIf you don't then subclass ORKStepViewController and you have even more freedom.\r\n\r\nNote that you don't need to modify ResearchKit to do this -- you should be able to subclass from outside ResearchKit, and then supply the view controller for \r\n\r\nThere's limited documentation here in \"Creating New Active Tasks\": [Active Tasks](http://researchkit.github.io/docs/docs/ActiveTasks/ActiveTasks.html)\r\n\r\nThe normal way is to create a new step subclass to match, but that's not strictly necessary. Instead you can use any step, and return your step view controller from the task view controller's `viewControllerForStep:` delegate method."}}