New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes when used with SwiftUI #1465
Comments
Hi @ablaw123, But getting this crash: Thanks. |
Hey Folks, Due to the adoption of scenes and the scene delegate, the app delegate no longer has a window property by default. You must add a property import SwiftUI
import HealthKit
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
final class AppDelegate: NSObject, UIApplicationDelegate {
//Just need to add this
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
print("Application did finish launching with options")
return true
}
} However, this "workaround" seems to make the modal have a transparent title. That you can solve this by setting the background color of the navigation bar to white (or the color of your preference) as @xinsight said in it answer. Also, you can use the same logic, and apply it to the let taskViewController = ORKTaskViewController(task: withdrawTask(), taskRun: nil)
taskViewController.delegate = self
taskViewController.navigationBar.backgroundColor = .white
// This step is optional
taskViewController.navigationBar.prefersLargeTitles = false
present(taskViewController, animated: true, completion: nil) |
@raafaelima #1469 should have solved the clear nav bar issue for you. |
When I call the researchkit from a swiftui button it crashes with the error "unrecognized selector sent to instance". Specifically, if I have a task that requires more than one screen.
Below is a sample of my code:
The text was updated successfully, but these errors were encountered: