iOS is the operating system for iPhone.

Posts under iOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

UITableView setTableHeaderView
我遇到了一个问题,当一个View是tableview的tableHeaderview时,我把View重新嵌套一层重新设置给tableHeaderview,这个View不展示 代码如下: UIView *view = [UIView new]; tableView.tableHeaderview = view; UiView *otherView = [UIview new]; otherView addSubview:view]; tableView.tableHeaderview = otherView; 这个时候view不展示了。 根据调用栈看,设置tableHeaderview后,view执行了一次removeFromSuperview,从otherView中消失了。 所以想了解一下,当设置新的tableHeaderview,对旧的HeaderView是怎么处理的?
1
0
124
1w
Get Touch Events from iOS keyboard trackpad mode
Hello, As of iOS 17, the keyboard app runs in a different process. I was wondering if there is a way to access the UIView of the keyboard app or if there is a way to subscribe to touch events done on the keyboard (especially during the trackpad mode). By trackpad mode I mean when the user long presses on space and then can move in the keyboard area (that turns into a trackpad) to move the caret in a text. Either Objective C or SwiftUI is fine. Thanks!
1
0
127
1w
EnvironmentObject Causes SwiftUI App to Crash When Launched in the Background
I recently encountered a difficult-to-diagnose bug in an app that I'm working on, and I thought I would share it with the Apple Developer community. The app that I'm working on is an iOS app that uses Core Location's Visit Monitoring API, and it is essential that the app is able to process incoming visits while running in the background. However, after real-world testing, I discovered several crash reports which were difficult to understand, as SwiftUI symbols are not symbolicated on debug builds. Eventually I discovered that the app was crashing when calling an @EnvironmentObject property of the root ContentView from that view's body when the app was launched directly into the background from not running at all. After creating a small test app to isolate the problem, I discovered that any environment object declared in the App struct and referenced from the root ContentView causes the crash, with the exception message: "Fatal error: No ObservableObject of type ArbitraryEnvObject found. A View.environmentObject(_:) for ArbitraryEnvObject may be missing as an ancestor of this view." It seems that when a SwiftUI app is launched in the background, the ContentView's body is executed, but the environment is not initialized. I searched through as much documentation as I could, but could not find any information about how this should be handled, so I think it's a bug in SwiftUI. I have filed a Feedback Assistant bug report. The current workaround is to convert my ObservableObject into an object that conforms to the new @Observable protocol, add it to the scene as an Environment Value with the .environment(_:) modifier rather than the .environmentObject(_:) modifier, and declare the @Environment property on the view as optional. The object will still be missing when the app is launched in the background, but the optional property can be handled safely to prevent a crash. Attached to this post is a sample project that demonstrates the issue and the workaround. And finally, I'd like to hear from anyone who knows more about the expected behavior of background launches of SwiftUI apps, and whether or not there's something I should be doing completely differently. I'm not able to directly attach a zip archive to this post, so here's an iCloud link to the sample project: BackgroundEnvObjCrash.zip
5
1
772
1w
[iOS 17.4+]CoreNFC does not throw exception when no valid iso7816.select-identifiers found
From iOS 17.4, CoreNFC does not seem to be throwing any exception when there are no valid iso7816.select-identifiers found during polling for a NFCTagReaderSession. Instead, CoreNFC would continue with processing the tag with no initialSelectedAID. This is an intended behavior after updates to CoreNFC on iOS17.4? Or is this behavior a bug and not actually intended?
0
0
117
1w
NO EXTENSIONS INSTALLED on Settings > Safari > Extensions
I'm developing an extension on Xcode, trying to test on my iPhone 7 plus. When I connect my iPhone with my Mac that Xcode is running on, and click Run, the app shows up on my iPhone. But when I check Settings > Safari > Extensions, it says "NO EXTENSIONS INSTALLED. Extensions customize the way Safari works. Extensions can change the appearance or behavior of web content, add buttons to Safari, and more." I'm using : Xcode : Version 14.0.1 Mac OS monterey : Version 12.7.5 iPhone 7 plus : Version 15.8.2
1
0
105
1w
Login with iPad Air works in Simulator but Apple says it doesn't
Device type: iPad Air (5th generation) OS version: iOS 17.5 I don't know what to do.. I am using Firebase for auth and it work on every device. Except for the iPad Air. Does somebody have a similar issue? try { String email = _emailController.text; String password = _passwordController.text; if (EmailValidator.validate(email)) { await _auth.signInWithEmailAndPassword( email: email, password: password); } else { print("Ungültige E-Mail-Adresse"); } } catch (e) { print("Anmeldefehler: $e"); } } }
0
0
82
1w
Website Header Disabled In Mcbook
Hy my name is zubair and i a blogger. I have recently create a website on gold price in oman url omangoldprices.com I maked a well design header footer and every thing as compared with my competitors but the header of my website disabled and not working on Macbook and macbook pro and the logo does not showing on IOS version Iphone 6 12.6.1. I am very comfused about that can anyone help me in?
0
0
116
1w
How to open app and show persistent notification upon receiving push notification on iOS
Hello everyone, I am developing a feature in my app where, upon receiving a push notification, the app should open automatically if it is closed and the screen is locked. If the device is unlocked, a persistent notification should appear and only be removed with user interaction. We managed to implement this functionality on Android using some configurations and additional rules. With this, upon receiving a push notification, the app opens automatically or a permanent notification appears. I would like to know how I can implement this functionality on iOS using Swift. Is there any specific configuration or API that allows the app to open automatically upon receiving a push notification or to display a persistent notification on the unlocked screen? Thanks in advance for your help!
1
0
120
1w
Could not install <appname> error in TestFlight
Hello, I have encountered this error in all the applications I have listened to so far on my individual developer account and I cannot test it. I heard that different developer friends of mine are experiencing this problem, especially on individual accounts. All test users I added to my account also have this problem. They all have different phones and operating system versions. I tried a lot of solutions on different computers, Xcode versions, etc. But I couldn't find a solution. Could you please help with this?
1
1
126
1w
Universal app link with query parameters is not working
I have configured AASA file to support path such as https://domain/forgot-password?token=asadsad3ddsd. It is not opening in browser nor app. I have tried different iterations to support the above url. iteration 1 : components : [ { "/" : "/forgot-password" , "?" : { "token" : "?*} ] iteration 2 : components : [ { "/" : "*" } ] iteration 3 : components : [ { "/" : "/forgot-password" , "?" : { "token" : "?????..." } ] my token is of length 36. so I have kept 36 question marks. do we need to configure something in flutter app delegate to support query parameters.
0
0
83
1w
UTI Conflicts, iOS
My iOS app wants to associate itself with a certain file extension, let's say .aaa. To do so I declare the following exported type: &lt;dict&gt; &lt;key&gt;UTTypeConformsTo&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.data&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UTTypeDescription&lt;/key&gt; &lt;string&gt;AAA File&lt;/string&gt; &lt;key&gt;UTTypeIdentifier&lt;/key&gt; &lt;string&gt;com.myapp.aaa&lt;/string&gt; &lt;key&gt;UTTypeTagSpecification&lt;/key&gt; &lt;dict&gt; &lt;key&gt;public.filename-extension&lt;/key&gt; &lt;array&gt; &lt;string&gt;aaa&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/dict&gt; As well as this under the supported document types: &lt;dict&gt; &lt;key&gt;CFBundleTypeExtensions&lt;/key&gt; &lt;array&gt; &lt;string&gt;aaa&lt;/string&gt; &lt;/array&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;AAA File&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;com.myapp.aaa&lt;/string&gt; &lt;/array&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Owner&lt;/string&gt; &lt;/dict&gt; Turns out, several other apps on the App Store also register the .aaa file extension, each under a different UTI, making it impossible to open .aaa in my app if they installed it after already having installed another app claiming this extension. Moreover, some of these app declare all of their supported file extensions under a single UTI (e.g. both .aaa and .bbb are associated with the com.theirapp.generic UTI), so I can't even add their UTI to LSItemContentTypes without associating myself with files I don't support. How do I force iOS to allow opening every file with the .aaa extension with my app, regardless of any potential third-party app registering the same extension? For clarification – the .aaa file extension in this example is always associate with a single type and format, but it doesn't have an agreed-on UTI identifier or MimeType, nor is there a single app that should be the sole "exporter" of the UTI type.
2
0
148
1w
Alternative option to initial onChange callback for EmptyView
I am exploring on managing state in SwiftUI app with purpose built Views due to the advantages for managing dependency with Environment. This is the minimal example I came up with: @MainActor struct AsyncStateModifier<T: Equatable>: View { let input: T let action: (T) async -> Void @Environment var queue: AsyncActionQueue var body: some View { return EmptyView() .onChange(of: input, initial: true) { old, new in queue.process(action: action, with: input) } } } The drawback of this approach is initial: true allows the onChange callback to fire when view appears and since EmptyView doesn't appear the action is never executed initially. When replacing EmptyView with Rectangle().hidden() this can be achieved, but I wanted to avoid having any impact on view hierarchy and EmptyView is suitable for that. Is there any alternative approach to make something like this possible?
1
0
122
1w
ios app crash
This is crash stack. What caused this crash? How to solve it? Date/Time: 2024-05-17 11:12:48.0370 +0800 Launch Time: 2024-05-17 11:12:28.4598 +0800 OS Version: iPhone OS 17.4.1 (21E236) Release Type: User Baseband Version: 3.50.04 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001aee09920 Triggered by Thread: 0 Kernel Triage: VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter Thread 0 Crashed: 0 libdispatch.dylib 0x00000001aee09920 _dispatch_lane_resume + 712 (queue.c:3284) 1 CoreFoundation 0x00000001a6f357a8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 (CFNotificationCenter.c:700) 2 CoreFoundation 0x00000001a6f35170 ___CFXRegistrationPost_block_invoke + 88 (CFNotificationCenter.c:193) 3 CoreFoundation 0x00000001a6f350b8 _CFXRegistrationPost + 440 (CFNotificationCenter.c:221) 4 CoreFoundation 0x00000001a6f34608 _CFXNotificationPost + 728 (CFNotificationCenter.c:1247) 5 Foundation 0x00000001a5dc6f10 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 (NSNotification.m:531) 6 UIKitCore 0x00000001a930f04c -[UIApplication _sendWillEnterForegroundCallbacks] + 212 (UIApplication.m:11709) 7 UIKitCore 0x00000001a930d7cc __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 1272 (_UISceneLifecycleMultiplexer.m:653) 8 UIKitCore 0x00000001a930d298 _UIScenePerformActionsWithLifecycleActionMask + 112 (_UISceneLifecycleState.m:109) 9 UIKitCore 0x00000001a9393934 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 (_UISceneLifecycleMultiplexer.m:566) 10 UIKitCore 0x00000001a92bcac4 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 220 (_UISceneLifecycleMultiplexer.m:515) 11 UIKitCore 0x00000001a92bb53c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 608 (_UISceneLifecycleMultiplexer.m:565) 12 UIKitCore 0x00000001a92baea4 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248 (_UISceneLifecycleMultiplexer.m:468) 13 UIKitCore 0x00000001a92bad74 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 148 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:73) 14 UIKitCore 0x00000001a92bac7c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736 (BSAnimationSettings+UIKit.m:54) 15 UIKitCore 0x00000001a92ba504 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224 (_UISceneSettingsDiffAction.m:27) 16 UIKitCore 0x00000001a92ba1b4 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:58) 17 UIKitCore 0x00000001a964ae20 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.226 + 612 (UIScene.m:2067) 18 UIKitCore 0x00000001a92b9328 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216 (UIScene.m:1736) 19 UIKitCore 0x00000001a92b9198 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244 (UIScene.m:2026) 20 UIKitCore 0x00000001a92b8fd8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336 (UIApplicationSceneClientAgent.m:86) 21 FrontBoardServices 0x00000001bfaeb524 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 660 (FBSScene.m:812) 22 FrontBoardServices 0x00000001bfaeb270 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152 (FBSWorkspaceScenesClient.m:692) 23 FrontBoardServices 0x00000001bfaeb10c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 (FBSWorkspace.m:411) 24 FrontBoardServices 0x00000001bfaeb028 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 344 (FBSWorkspaceScenesClient.m:691) 25 libdispatch.dylib 0x00000001aee02dd4 _dispatch_client_callout + 20 (object.m:576) 26 libdispatch.dylib 0x00000001aee0686c _dispatch_block_invoke_direct + 288 (queue.c:511) 27 FrontBoardServices 0x00000001bfae7490 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 (FBSSerialQueue.m:285) 28 FrontBoardServices 0x00000001bfae7410 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240 (FBSSerialQueue.m:309) 29 FrontBoardServices 0x00000001bfae72e8 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:322) 30 CoreFoundation 0x00000001a6f3d62c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957) 31 CoreFoundation 0x00000001a6f3c8a8 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 32 CoreFoundation 0x00000001a6f3b058 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038) 33 CoreFoundation 0x00000001a6f39d88 __CFRunLoopRun + 828 (CFRunLoop.c:2955) 34 CoreFoundation 0x00000001a6f39968 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420) 35 GraphicsServices 0x00000001eb22f4e0 GSEventRunModal + 164 (GSEvent.c:2196) 36 UIKitCore 0x00000001a93acedc -[UIApplication _run] + 888 (UIApplication.m:3692) 37 UIKitCore 0x00000001a93ac518 UIApplicationMain + 340 (UIApplication.m:5282) 38 VRCapture 0x00000001045ac3a4 main + 84 (main.m:33) 39 dyld 0x00000001ca45ad84 start + 2240 (dyldMain.cpp:1298)
0
0
134
1w
How to distribute a DriverKit extension to third parties developing on iOS
Hello, We're developing a framework that needs to talk to a camera on iOS. We've written a Driverkit Extension to enable this but we're having trouble working out how to distribute this to third parties. We have to specify the application's bundle id in the driverkit's bundle ID. But as far as I can tell that means if there are multiple consumers, they each need their own specially built driverkit extension. For MacOS, we can see an entitlement that allow any 'user client' to connect to our driverkit extension. But from what I can tell, that doesn't seem to be the same for iOS. Am I missing something? Or is it expected that we should have to build a new driverkit extension with a different bundle ID for every app that every third party wants to develop? Let me know if I'm missing too much context, thanks in advance!
1
0
170
1w
How do you get the cursor to appear programmatically in a custom UITextInput with UITextInteraction?
I have created a custom input field by conforming to UITextInput. It is setup to use UITextInteraction. Everything works very well. If the user taps on the custom field, the cursor (provided by UITextInteraction) appears. The user can type, select, move the cursor, etc. But I'm stumped trying to get the cursor to appear automatically. With a normal UITextField or UITextView you simply call becomeFirstResponder(). But doing that with my custom UITextInput does not result in the cursor appearing. It only appears if the user taps on the custom field. I don't know what I'm missing. I don't see any API in UITextInteraction that can be called to say "activate the cursor layer". Does anyone know what steps are required with a custom UITextInput using UITextInteraction to activate the cursor programmatically without the user needing to tap on the custom field?
3
0
391
1w
Is the code in 'Building a custom peer-to-peer protocol' insecure?
I'm new to Networking, so forgive me if this is a silly question: In the sample code, Building a custom peer-to-peer protocol, TLS is configured as follows: // Create TLS options using a passcode to derive a pre-shared key. private static func tlsOptions(passcode: String) -> NWProtocolTLS.Options { let tlsOptions = NWProtocolTLS.Options() let authenticationKey = SymmetricKey(data: passcode.data(using: .utf8)!) var authenticationCode = HMAC<SHA256>.authenticationCode(for: "TicTacToe".data(using: .utf8)!, using: authenticationKey) let authenticationDispatchData = withUnsafeBytes(of: &authenticationCode) { (ptr: UnsafeRawBufferPointer) in DispatchData(bytes: ptr) } sec_protocol_options_add_pre_shared_key(tlsOptions.securityProtocolOptions, authenticationDispatchData as __DispatchData, stringToDispatchData("TicTacToe")! as __DispatchData) sec_protocol_options_append_tls_ciphersuite(tlsOptions.securityProtocolOptions, tls_ciphersuite_t(rawValue: TLS_PSK_WITH_AES_128_GCM_SHA256)!) return tlsOptions } The sample code touts the connection as secure ("...uses Bonjour and TLS to establish secure connections between nearby devices"), but to my untrained eye it doesn't seem so. My reasoning is as follows: If I adapt this code as-is, so connections between two instances of my app use SymmetricKeys derived from the four-digit passcode, then wouldn't my encryption be easy to break by an adversary who sends 0000...9999 and records corresponding changes in the encryption, exposing my app to all sorts of attacks? The sample uses the passcode to validate the connection (host user shows client user the passcode, which is manually entered), which is a feature I would like to keep in some form or another, which is why this is causing so many headaches. Generally speaking, is there a way to secure a local peer-to-peer connection over Network.framework that doesn't involve certificates? If certificates are the only way, are there good resources you can recommend?
6
0
619
1w
Webview localStorage gets cleared if navigate away from page on iOS
I'm experiencing an issue with WKWebView and localStorage. I've set up a standard WKWebView with the configuration: configuration.websiteDataStore = WKWebsiteDataStore.default() Everything works fine in the emulator (iOS 16.x, 17.0), but on my iPhone 13 running iOS 17.4, I encounter a problem. When I set a localStorage value on my local HTML page, navigate to another URL within the webview, and then return to the original page, the localStorage is cleared. This behavior is new and wasn't happening before. Has anyone else encountered this or have any suggestions on how to fix it? The localstorage should be persistent as it always has been.
0
0
188
1w
iOS 17.4 AppProxyProvider not starting when Apps (associated with PerAppVPN) access network resource
Hi, With iOS-17.4 update, we are seeing AppProxy VPN not getting started when Apps (associated with PerAppVPN) tried to access network resource after MDM PerAppVPN profile install/update. Looks like PerApp rules associated with applayer vpn profile are broken after profile update/install as we see internet sites working without going through VPN (appProxy network extension), this start working if we toggle WiFi and then access network resource from Apps associated with PerAppVPN. Created FB13688086 with all the details for this iOS 17.4 and AppLayerVPN, looking for and update here and any feedback/pointers will help. Thanks
8
2
883
1w