iOS is the operating system for iPhone.

Posts under iOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Is there an API to check if a Core ML compiled model is already cached?
Hello Apple Developer Community, I'm investigating Core ML model loading behavior and noticed that even when the compiled model path remains unchanged after an APP update, the first run still triggers an "uncached load" process. This seems to impact user experience with unnecessary delays. Question: Does Core ML provide any public API to check whether a compiled model (from a specific .mlmodelc path) is already cached in the system? If such API exists, we'd like to use it for pre-loading decision logic - only perform background pre-load when the model isn't cached. Has anyone encountered similar scenarios or found official solutions? Any insights would be greatly appreciated!
0
0
58
3w
How to disable/hide Audio Controls on lock screen from WkWebView
Hi, I am trying to remove the audio controls for my app on the lock screen. Since I use WKWebView, there are 3 audio tags in my html and I play and pause em via JS. However, if I do not play any sound since app launch, there are no audio controls on the lock screen. But if I play one of those 3 files (they are even less then 3 Sec sound effects e.g. for buttons) the audio controls appears on lock screen. Note even when the sounds on pause() or not playing they were listed on the lock screen. What I have tried so far without success MPNowPlayingInfoCenter.default().nowPlayingInfo = [:] and ``try audioSession.setCategory(.playback, mode: .default, options: []) try audioSession.setActive(false, options: .notifyOthersOnDeactivation)`` and UIApplication.shared.endReceivingRemoteControlEvents() Another problem is that the app scales with iOS system settings "display zoom". Is there a way to deny it? It is latest Xcode verion 16.3 and iOS 18. I have no background mode in my Capabilities. Nothing worked so far. Has anyone an idea? Greetings
2
0
47
3w
Live Lookup flow stuck at /issue/token-key-for-user-token endpoint
Hi Apple engineering team, I’m trying to integrate the new Live Caller ID Lookup (PIR) on iOS using your pir-service-example code as well as a custom mock server in Vapor, but the extension never advances past the /issue/token-key-for-user-token step. I’ve tried both: 1. Official Example Cloned https://github.com/apple/pir-service-example Ran PIRService locally Confirmed that GET /.well-known/private-token-issuer-directory → 200 GET /issue/token-key-for-user-token → 200 (DER bytes, correct SPKI) No POST /issue ever fires 2. Mock Server (Vapor) Implemented all five endpoints (/config, /.well-known/private-token-issuer-directory, /issue/token-key-for-user-token, /issue, /queries) Verified with curl and openssl asn1parse that: GET /.well-known/private-token-issuer-directory Content-Type: application/private-token-issuer-directory { "issuer-request-uri":"https://…/issue", "token-keys":[…] } GET /issue/token-key-for-user-token Content-Type: application/octet-stream <DER bytes> Added Cache-Control: public, max-age=3600 on directory and SPKI Stubbed POST /issue to always return { "token": "" } Still no POST /issue request from the extension Reproduction Steps Install and enable a Live Lookup extension pointing to my server. Trigger an incoming call on device. Watch server logs—only see the two GETs, never /issue or /queries. Expected Behavior After fetching the SPKI DER, the framework should issue a POST /issue call (Privacy Pass flow) and then POST /queries. Observed Behavior Stuck in an infinite loop of: GET /.well-known/private-token-issuer-directory GET /issue/token-key-for-user-token (repeat…) No progression to the /issue or /queries endpoints. What I’ve Tried Verified JSON kebab-case and headers exactly match examples Confirmed SPKI DER is valid via openssl asn1parse Added Cache-Control headers Tested on real device, localhost url, and ngrok public URL Mocked a valid-looking token response Could you advise what additional requirement or format detail I’m missing that prevents from advancing past /issue/token-key-for-user-token? These are the main files: LiveLookupExtension.swift routes.swift service-config.json Thanks in advance!
0
0
45
3w
ARKit Camera Feed Zoom & Macro Support for Close-Range Objects
I am currently developing an AR experience using ARKit with SceneKit and am looking to implement functionality that enables: Zooming into the AR camera feed, ideally leveraging the ultra-wide or telephoto lenses available on supported devices. Macro-style focus capabilities, allowing users to view and interact with virtual content closely aligned with small or nearby real-world objects (within a few centimeters). My objective is to ensure that ARKit continues to render the scene accurately while enabling a zoomed-in view or macro-level focus for better detail visibility and alignment. Could you please advise on: Whether ARKit currently supports camera zoom or allows access to macro or ultra-wide cameras within an ARSession. Limitations or considerations when using multi-camera setups in conjunction with ARKit. Any guidance or references to documentation or sample code would be greatly appreciated.
0
0
45
3w
How to achieve a pure backdrop blur effect without predefined tint color in SwiftUI / UIKit?
Hi everyone, I’m currently trying to create a pure backdrop blur effect in my iOS app (SwiftUI / UIKit), similar to the backdrop-filter: blur(20px) effect in CSS. My goal is simple: • Apply a Gaussian blur (radius ~20px) to the background content • Overlay a semi-transparent black layer (opacity 0.3) • Avoid any predefined color tint from UIBlurEffect or .ultraThinMaterial, etc. However, every method I’ve tried so far (e.g., .ultraThinMaterial, UIBlurEffect(style:)) always introduces a built-in tint, which makes the result look gray or washed out. Even when layering a black color with opacity 0.3 over .ultraThinMaterial, it doesn’t give the clean, transparent-black + blur look I want. What I’m looking for: • A clean 20px blur effect (like CIGaussianBlur) • No color shift/tint added by default • A layer of black at 30% opacity on top of the blur • Ideally works live (not a static snapshot blur) Has anyone achieved something like this in UIKit or SwiftUI? Would really appreciate any insights, workarounds, or libraries that can help. Thanks in advance! Ben
3
0
73
1w
MPNowPlayingInfoCenter nowPlayingInfo throttled
Hello, I have been running into issues with setting nowPlayingInfo information, specifically updating information for CarPlay and the CPNowPlayingTemplate. When I start playback for an item, I see lock screen information update as expected, along with the CarPlay now playing information. However, the playing items are books with collections of tracks. When I select a new track(chapter) within the book, I set the MPMediaItemPropertyTitle to the new chapter name. This change is reflected correctly on the lock screen, but almost never appears correctly on the CarPlay CPNowPlayingTemplate. The previous chapter title remains set and never updates. I see "Application exceeded audio metadata throttle limit." in the debug console fairly frequently. From that a I figured that I need to minimize updates to the nowPlayingInfo dictionary. What I did: I store the metadata dictionary in a local dictionary and only set values in the main nowPlayingInfo dictionary when they are different from the current value. I kick off the nowPlayingInfo update via a task that initially sleeps for around 2 seconds (not a final value, just for my current testing). If a previous Task is active, it gets cancelled, so that only one update can happen within that time window. Neither of these things have been sufficient. I can switch between different titles entirely and the information updates (including cover art). But when I switch chapters within a title, the MPMediaItemPropertyTitle continues to get dropped. I know the value is getting set, because it updates on the lock screen correctly. In total, I have 12 keys I update for info, though with the above changes, usually 2-4 of them actually get updated with high frequency. I am running out of ideas to satisfy the throttling thresholds to accurately display metadata. I could use some advice. Thanks.
2
0
65
3w
iOS Simulator (18.4) crashes when user clicks allow for Speech Recognition permission popup
When a new application runs on iOS 18.4 simulator and tries to access the Speech Framework, prompting a request for authorisation to use Speech Recognition, the application will crash if the user clicks allow. Same issue in the visionOS 2.4 simulator. Using Swift 6. Report Identifier: FB17686186 /// Checks speech recognition availability and requests necessary permissions. @MainActor func checkAvailabilityAndPermissions() async { logger.debug("Checking speech recognition availability and permissions...") // 1. Verify that the speechRecognizer instance exists guard let recognizer = speechRecognizer else { logger.error("Speech recognizer is nil - speech recognition won't be available.") reportError(.configurationError(description: "Speech recognizer could not be created."), context: "checkAvailabilityAndPermissions") self.isAvailable = false return } // 2. Check recognizer availability (might change at runtime) if !recognizer.isAvailable { logger.error("Speech recognizer is not available for the current locale.") reportError(.configurationError(description: "Speech recognizer not available."), context: "checkAvailabilityAndPermissions") self.isAvailable = false return } logger.trace("Speech recognizer exists and is available.") // 3. Request Speech Recognition Authorization // IMPORTANT: Add `NSSpeechRecognitionUsageDescription` to Info.plist let speechAuthStatus = SFSpeechRecognizer.authorizationStatus() logger.debug("Current Speech Recognition authorization status: \(speechAuthStatus.rawValue)") if speechAuthStatus == .notDetermined { logger.info("Requesting speech recognition authorization...") // Use structured concurrency to wait for permission result let authStatus = await withCheckedContinuation { continuation in SFSpeechRecognizer.requestAuthorization { status in continuation.resume(returning: status) } } logger.debug("Received authorization status: \(authStatus.rawValue)") // Now handle the authorization result let speechAuthorized = (authStatus == .authorized) handleAuthorizationStatus(status: authStatus, type: "Speech Recognition") // If speech is granted, now check microphone if speechAuthorized { await checkMicrophonePermission() } } else { // Already determined, just handle it let speechAuthorized = (speechAuthStatus == .authorized) handleAuthorizationStatus(status: speechAuthStatus, type: "Speech Recognition") // If speech is already authorized, check microphone if speechAuthorized { await checkMicrophonePermission() } } }
0
0
86
3w
Clarification on Use of exit(0) in iOS App for Fatal Error Recovery
I am reaching out to seek clarification on the usage of exit(0) within an iOS application under specific circumstances, as I have not been able to find concrete guidance on this in the App Store Review Guidelines Context of Our Application: We are developing a mobile game using Cocos2d-JS (Cocos2d-x JavaScript bindings). The game is built in C++ with JavaScript used for game logic, and it runs on both Android and iOS. Occasionally, due to an unrecoverable fatal JavaScript error (e.g., corrupted state or unexpected runtime crash), the game’s screen goes completely black. When this occurs, the rendering engine halts, user interaction becomes impossible, and the app enters a non-functional state. From this point, the only way to return to a working state is to manually terminate and relaunch the app. We are exploring a user-friendly solution where, upon detecting such a critical failure, we present a native UIAlertController to the user explaining the issue and informing them that the app needs to restart. Upon confirmation (i.e., tapping “OK”), we call exit(0) to gracefully close the app, so the user can relaunch it in a working state. Our Question: Is it acceptable to use exit(0) in this very limited and clearly explained context? The intention is to improve the user experience during unrecoverable fatal states that cannot be handled through standard UI or engine resets. I understand that the use of exit(0) is generally discouraged, but in our case: The user explicitly initiates the exit via a native prompt. The app is not quitting on its own or in response to a policy violation. We are not using exit(0) to bypass App Review or circumvent system behavior. There is no mention in the App Review Guidelines explicitly stating whether or not exit(0) is disallowed in such edge cases. Please confirm whether this approach aligns with Apple's policies, or suggest an alternative method for cleanly handling such irrecoverable errors on iOS? Looking forward to your guidance.
2
0
54
4w
Best Way to Help Users Diagnose iOS App Crashes with No UI Feedback
Hi all, We're working on an iOS application and would like to improve our ability to diagnose failures - especially in scenarios where the app crashes before it can present any UI to the user. A few specific questions: In case of an exception or crash, is there a way to log the issue so the user (or our support team) can understand the cause of the failure? If the app crashes abruptly (e.g., due to a runtime exception or crash during launch), is there a recommended way to persist error information before the process terminates? Are there Apple-supported mechanisms (like crash reporting tools or APIs) we can integrate that would help us capture such issues? What’s the best practice for enabling support teams to assist users based on crash reports - especially for crashes that happen before any user interaction? Our goal is to make sure users aren't left in the dark if the app fails to start, and to allow us to deliver timely updates or support based on the cause of the crash. Thanks in advance for your guidance!
Topic: UI Frameworks SubTopic: General Tags:
0
0
41
4w
Best practices for accessing NavigationPath in child views
Hi all I'm reworking our app in SwiftUI. My ultimate goal is to access the NavigationPath from a child view which is used throughout different NavgationStacks. While searching for I came across different ways of achieving this. As I'm relatively new to SwiftUI it is hard to understand what the actual best practice seems to be. So for the use case. My app has a TabView and each Tab has its own NavigationStack which looks something like this struct TabNavigation: View { @State private var selectedProductType: StaticProductType = .all @StateObject private var appRouter = AppRouter() var body: some View { TabView(selection: $appRouter.selectedTab) { Overview(activeType: $selectedProductType) .tabItem { Label("Home", systemImage: "house") } .tag(Tab.home) AssortmentView(router: $appRouter.assortmentRouter, activeType: $selectedProductType) .tabItem { Label(String(localized: "assortment"), systemImage: "list.bullet") } .tag(Tab.assortment) } } The AssortmenView holds the NavigationStack and defines the routes. struct AssortmentView: View { @Binding var router: AssortmentRouter @Binding var activeType: StaticProductType var body: some View { NavigationStack(path: $router.navigationPath) { VStack { ProductTypeNavigation(activeType: $activeType) .padding(.top, 10) .padding(.horizontal, 10) Spacer() TabView(selection: $activeType) { ListNavigation(type: .all) .tag(StaticProductType.all) ListNavigation(type: .games) .tag(StaticProductType.games) ListNavigation(type: .digital) .tag(StaticProductType.digital) ListNavigation(type: .toys) .tag(StaticProductType.toys) ListNavigation(type: .movies) .tag(StaticProductType.movies) ListNavigation(type: .books) .tag(StaticProductType.books) } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) } .addToolbar() .navigationDestination(for: AssortmentRouter.Route.self) { route in switch route { case .overview(let type): OverviewTypeView(type: type) case .productDetail(let productId): ProductDetailView(productId: productId) .environmentObject(router) case .productList: ProductList() } } } } } Through my app I often use a view to displaying products. This view is reused over different NavigationStacks. struct ProductDetailView: View { var productId: Int @StateObject private var viewModel: ProductDetailViewModel = ProductDetailViewModel() @State private var showErrorAlert = false @EnvironmentObject var router: AssortmentRouter var body: some View { VStack { if !viewModel.isRefreshing { let product = viewModel.product VStack { Text("Product: \(product.title)") NavigationLink(destination: ProductDetailView(productId: Product.preview.productId)) { Text("Test") } } .navigationTitle(product.title) } else { ProgressView() } }.task { await loadProduct() } .alert("Error", isPresented: $showErrorAlert, presenting: viewModel.localizedError) { _ in Button("Try again") { Task { await loadProduct() } } Button("Go Back", role: .cancel) { // access navigationPath } } message: { errorMessage in Text(errorMessage) } } @MainActor private func loadProduct() async { await viewModel.loadProduct(productId: productId) showErrorAlert = viewModel.localizedError != nil } } In this example I created an AppRouter which holds all information for the routes and some functions to accessing the NavigationPath. class AppRouter: ObservableObject { var assortmentRouter = AssortmentRouter() var selectedTab: Tab = .home func navigateTo(tab: Tab) { selectedTab = tab } } class AssortmentRouter: ObservableObject { var navigationPath = NavigationPath() enum Route: Hashable { case overview(type: StaticProductType) case productList case productDetail(productId: Int) } func navigateTo(route: Route) { navigationPath.append(route) } } This works fine as it is. The pro of this solution is that I don't have to pass the NavigationPath down each subview to use it as I can define it as EnvrionmentObject. The problem with this though, I like to reuse ProductDetailView also in my other NavigationStack which won't have a router binding of type AssortmentRouter as you can imagine. To come back to my initial question, what would be the best way to design this? Passing down a NavigationPath Binding and using different typing for navigationDestinaion values Define a callback which is passed as function parameter to the detail view Using dismiss, but I read that this is can lead to weird behaviour and bugs Any other option? Maybe changing the app architecture to handle this a better way Apolgize the long post, but I would be really glad to get some feedback on this, so I can do it the right way. Thank you very much
3
0
54
4w
tabItem vs. Tab() — how to support iOS 17 and 18?
Hi, I'm adding tabs to the iOS version of my multiplatform app using TabView. I want the individual tabs to have names and icons. In iOS 17 and below, I have to do this using: tabContent().tabItem { Label(titleKey, systemImage: systemImage) } but this is deprecated, so in iOS 18 I would like to use the new version: Tab(titleKey, image: systemImage) { content() } It would be annoying to have to have the two cases for each individual tab, so I'm trying to abstract it into a custom SwiftUI view like this: var body: some View { if #available(iOS 18.0, *) { Tab(titleKey, image: systemImage) { content() } } else { content().tabItem { Label(titleKey, systemImage: systemImage) } } } There's a bit more to the custom view because I also have cases for iPad and macOS where I just have the views next to each other without tabs, but that's not really relevant to the question other than providing further motivation for abstracting this. However, with this code, I get the error: 'buildExpression' is unavailable: this expression does not conform to 'View' on the Tab line, because Tab isn't a view, and it can only be used directly inside a TabView. For now at least, I can just use tabItem on all iOS versions and it works, but I'd prefer not to in case it is removed some time soon. I do want to support iOS 17 because that's what my iPad runs. Is there any clean way to do this?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
85
May ’25
購入情報をサーバーで管理する場合は、アプリからサーバーに購入情報を渡す際にレシート検証する必要があるのか
アプリ内課金を実装しようとしていますが、サーバサイドのセキュリティに関してについて質問です。 StoreKit2を使えばアプリとApp Store Connect間のレシート検証は不要だが、 購入情報をサーバーで管理する場合は アプリからサーバーに購入情報を渡す際にレシート検証する必要があると考えるがその認識であっているか教えていただきたいです。
0
0
40
May ’25
Speech Recognition Entitlement Not Appearing in App ID Capabilities
Hello, I recently enrolled in the Apple Developer Program and created an App ID with the bundle ID com.echo.eyes.voice. I am trying to enable Speech Recognition in the App ID capabilities list, but the option does not appear — even after waiting over a week since my membership was activated. I’ve already: Confirmed my Apple Developer account is active Checked the Identifiers section in the Developer portal Tried editing the App ID, but Speech Recognition is not listed Contacted both Developer Support and Developer Technical Support (Case #102594089120), but was told to post here for help My app uses Capacitor + the @capacitor-community/speech-recognition plugin. I need the com.apple.developer.speech-recognition entitlement to appear so I can use native voice input in iOS. I would really appreciate help from an Apple engineer or anyone who has faced this issue. Thank you, — Daniel Colyer
3
0
74
2w
Unable to Find Local Network Devices in Simulator – Permission Issue on M4 Mac, macOS 15.5, Xcode 16.1
Hello, I'm running into an issue while developing an iOS app that requires local network access. I’m using the latest MacBook Air M4 with macOS sequoia 15.5 and Xcode 16.1. In the iOS Simulator, my app fails to discover devices connected to the same local network. I’ve already added the necessary key to the Info.plist: NSLocalNetworkUsageDescription This app needs access to local network devices. When I run the app on a real device and M2 Chip Macbook's simulators, it works fine for local network permission as expected. However, in the M4 Chip Macbook's Simulator: The app can’t find any devices on the local network Bonjour/mDNS seems not to be working as well I’ve tried the following without success: Restarting Simulator and Mac Resetting network settings in Simulator Confirming app permissions under System Settings > Privacy & Security Has anyone else encountered this issue with the new Xcode/macOS combo? Is local network access just broken in the Simulator for now, or is there a workaround? Thanks in advance!
1
0
81
May ’25