Post

Replies

Boosts

Views

Activity

Is ARGeoTrackingConfiguration always more accurate than ARWorldTrackingConfiguration for world scale AR?
We are working on a world scale AR app that leverages the device location and heading to place objects in the streets, so that they are correctly and stably anchored to certain locations. Since the geo-tracking imagery is only available in certain cities and areas, we are trying to figure out how to fallback when geo-tracking is not available as the device move away, to still retain good AR camera accuracy. We might need to come up with some algorithm using the device GPS, to line up the ARCamera with our objects. Question: Does geo-tracking always provide greater than or equal to the accuracy of world tracking, for a GPS outdoor AR experience? If so, we can simply use the ARGeoTrackingConfiguration for the entire time, and rely on the ARView keeping itself aligned. Otherwise, we need to switch between it and ARWorldTrackingConfiguration when geo-tracking is not available and/or its accuracy is low, then roll our own algorithm to keep the camera aligned. Thanks.
2
0
415
Jan ’24
App killed in the background with NavigationSplitView on iOS 16
Description We have a sidebar-detail layout in our app. Since we moved from NavigationView on iOS 15 to NavigationSplitView on iOS 16, we've seen some issues. On iOS 16, the app is always killed, or reset, when the app enters background. That means whatever the sidebar and detail view show, they will almost always return to the initial blank screen state when coming back from background. On iOS 17, the background issue is mitigated. However, the toolbar button is missing after coming back from background. Those problem aren't present in NavigationView on iOS 15. Steps to Repro General steps… Create a new iOS app demo project with deployment target min version set to iOS 16. Copy and paste the code snippet below into ContentView.swift. Run the app on iPad simulator with the respective Simulator OS versions. iOS 16 Tap the info button on the side bar, it presents a "form sheet" style page. Put the app into background. Open any app. I opened the Photos app. Switch back to the demo app. The sheet is dismissed and the app returns to the initial state, which indicates the app was reset in the background. When I tap the info button again, it doesn't present a sheet. iOS 17 Same steps as 1-3 above for iOS 16. Switch back to the test app. The sheet is not dismissed, which means the app wasn't reset in the background. However, you can see the info button is missing from the sidebar's top toolbar. Similar Posts NavigationSplitView resetting when app enters background: https://developer.apple.com/forums/thread/733472 Selection state is lost when navigating to/from home screen: https://developer.apple.com/forums/thread/728657 SwiftUI NavigationSplitView looses toolbar button when App moves to background - iOS 17 / Xcode 15.0: https://stackoverflow.com/questions/77253055 Repro Code Snippet import SwiftUI struct ContentView: View { let samples = ["foo", "bar"] var body: some View { NavigationSplitView { NavigationStack { sidebar } } detail: { NavigationStack { detail } } } var sidebar: some View { Sidebar(samples: samples) } var detail: some View { Text("Select a sample from the list.") } } struct Sidebar: View { @State private var isPresented = false let samples: [String] var body: some View { List { ForEach(samples, id: \.self) { sample in Text(sample) } } .navigationTitle("Foo") .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button("Info") { isPresented = true } .sheet(isPresented: $isPresented) { AboutView() } } } } } struct AboutView: View { @Environment(\.dismiss) private var dismiss: DismissAction var body: some View { NavigationStack { List { Text("Copyright © 2023 Foo. All Rights Reserved.") } .navigationTitle("About") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .confirmationAction) { Button("Done") { dismiss() } } } } } }
1
0
567
Dec ’23
WKWebView throws RBSServiceError when multiple SwiftUI views are created
Description I've seen this issue when I use WKWebView in SwiftUI. If I have 2 web views at once in a SwiftUI view, it produces unwanted console warnings that seem to be not solvable on client side. The warnings aren't present when there is only 1 web view. Similar warnings regarding the "running board" or RBSAssertionErrorDomain are reported by others as well. Please advice how to dismiss these warnings in the app. Thank you. Repro Steps and Code Create a new iOS project. Put the following code into ContentView.swift. It wraps a WKWebView in SwiftUI and display some dummy html data in the web views. Build and run the app. Tap the info button. Drag down or dismiss the sheet. Upon dismiss, in the console it prints the error messages attached below. import SwiftUI import WebKit struct ContentView: View { @State private var isInfoViewPresented = false @State private var selectedIndex = 0 func makeErrorHTML(index: Int) -> String { #"<!doctype html><html><h1 style="text-align: center;">Unable to display README.</h1></html>"# } var body: some View { VStack(spacing: 8) { Text("Hello, world!") Button { isInfoViewPresented = true } label: { Image(systemName: "info.circle") .imageScale(.large) } .sheet(isPresented: $isInfoViewPresented) { sheetContent } } } var sheetContent: some View { NavigationStack { ZStack { WebView(htmlString: makeErrorHTML(index: 0)) .background(Color(uiColor: .systemGray)) .opacity(selectedIndex == 0 ? 1 : 0) WebView(htmlString: makeErrorHTML(index: 1)) .background(Color(uiColor: .systemGray2)) .opacity(selectedIndex == 1 ? 1 : 0) } .toolbar { ToolbarItem(placement: .principal) { Picker("Information Mode", selection: $selectedIndex) { Text("0").tag(0) Text("1").tag(1) } .pickerStyle(.segmented) } ToolbarItem(placement: .confirmationAction) { Button("Done") { isInfoViewPresented = false } } } } } } struct WebView: UIViewRepresentable { /// The HTML to load in the web view. let htmlString: String func makeUIView(context: Context) -> WKWebView { // Creates an empty web view. let webView = WKWebView(frame: .zero) // Sets the web view's navigation delegate. webView.navigationDelegate = context.coordinator return webView } func updateUIView(_ webView: WKWebView, context: Context) { // Loads the given HTML string. webView.loadHTMLString(htmlString, baseURL: nil) } func makeCoordinator() -> Coordinator { Coordinator() } class Coordinator: NSObject, WKNavigationDelegate { func webView( _ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void ) { switch navigationAction.navigationType { case .linkActivated: if let url = navigationAction.request.url, UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } decisionHandler(.cancel) default: decisionHandler(.allow) } } } } OS Version iOS 15 - iOS 17 Simulator and Device Xcode Version 15.0.1 (15A507) macOS 14.1.1 (23B81) Similar Posts @eskimo shared information about runningboard in this post: https://developer.apple.com/forums/thread/702207 https://developer.apple.com/forums/thread/709919 https://stackoverflow.com/questions/69902932/error-acquiring-assertions-what-is-that https://developer.apple.com/forums/thread/708801 Error From Console Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 0x11e024780 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=85,796, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 0x11e0247e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=85,796, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 0x11e0248a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=85,797, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2
0
1.9k
Dec ’23
How to set segmented picker style to use the full width in iOS 17?
Before iOS 17 beta, the .pickerStyle(.segmented) modifier makes the Picker take up the entire available width in a toolbar. In iOS 17, it tightly fits the width of the text. I can use .fixedSize() modifier to make the segmented control tightly fit the content. In reverse, what is the recommended way to make it expand to fill the whole width? In iOS 17 beta, I tried .frame(idealWidth: UIScreen.main.bounds.width) and it works, but it doesn't have effect in iOS 16 and prior. Also, it is semantically wrong to set the ideal width to an arbitrary big value. Example: iOS 16, full iOS 17, tight
3
0
1.2k
Aug ’23
iOS 17 beta "You don’t have permission to save the file" crash on device
Issue This issue is reproducible on iOS 17 beta 4 and iOS 17.0 (21A5303d) public beta. When try to create a folder using the FileManager API, the app crashes with the following stack trace. Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “Samples” in the folder “…”." UserInfo={NSURL=file://…/Samples.app/, NSUnderlyingError=0x28100cf00 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} What is the user impact? Users will not be able to run the app on iOS 17 Steps to Reproduce Create a new project Add the following code import SwiftUI struct ContentView: View { var body: some View { Text("Hello, world!") .onAppear { _ = makeTemporaryDirectory() } } /// Creates a temporary directory. private func makeTemporaryDirectory() -&gt; URL { try! FileManager.default.url( for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: Bundle.main.bundleURL, create: true ) } } Build and run the app. It crashes on the force try line. O/S: iOS 17 (Beta 4) / iOS 17.0 (21A5303d) Device: iPad Pro Gen 4, iPhone 11. Only happens on real device, not on the simulators
5
2
2.2k
Aug ’23