Post

Replies

Boosts

Views

Activity

Crash using .searchable bound to viewModel and sidebar placement on macOS
On macOS 14.2.1 (23C71), xCode 15.2 (15C500b) Reported as FB13541783 Demo: https://youtu.be/pm6Nre0RApY Consider this complete SwiftUI macOS app // // TestSearchStringInViewModelApp.swift // TestSearchStringInViewModel // // Created by Damian Mehers on 2024-01-15. // import SwiftUI @main struct TestSearchStringInViewModelApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { // using @Bindable or plain "var" with a Bindable<ViewModel> object in the code does same thing @State var viewModel = ViewModel() var body: some View { NavigationSplitView { VStack { List(1..<5) { n in Text("\(n)") } .listStyle(SidebarListStyle()) // Works if not sidebar or @State searchString .searchable(text: $viewModel.searchString, placement: .sidebar) } } detail: { Text("Some detail") } } } @Observable final class ViewModel { var searchString = "" } When you run it, when you tap “a” into the searchbar two “a”s appear, and when they are both deleted you get a crash: An uncaught exception was raised *** -[NSBigMutableString substringWithRange:]: Range {0, 1} out of bounds; string length 0 ( 0 CoreFoundation 0x00000001820d0570 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000181bc1eb4 objc_exception_throw + 60 2 Foundation 0x0000000183131930 -[NSString _newSubstringWithRange:zone:] + 0 3 AppKit 0x00000001859e6f28 -[NSTextStorage(NSUndo) _undoRedoAttributedSubstringFromRange:] + 140 4 AppKit 0x00000001859e6e04 -[NSUndoTyping initWithAffectedRange:textStorage:undoManager:replacementRange:] + 132 5 AppKit 0x00000001859e6c6c -[NSTextViewSharedData coalesceInTextView:affectedRange:replacementRange:] + 308 6 AppKit 0x00000001859e5f38 -[NSTextView(NSSharing) shouldChangeTextInRanges:replacementStrings:] + 968 7 AppKit 0x00000001861f9d18 -[NSTextView performValidatedReplacementInRange:withAttributedString:] + 196 8 SwiftUI 0x00000001ae4223d8 OUTLINED_FUNCTION_6 + 2648 9 SwiftUI 0x00000001ae53c724 OUTLINED_FUNCTION_1 + 8004 10 SwiftUI 0x00000001ae53bfd4 OUTLINED_FUNCTION_1 + 6132 11 SwiftUI 0x00000001ae53ba8c OUTLINED_FUNCTION_1 + 4780 12 SwiftUI 0x00000001ae53acb8 OUTLINED_FUNCTION_1 + 1240 13 SwiftUI 0x00000001aced8030 OUTLINED_FUNCTION_38 + 907680 14 SwiftUI 0x00000001ad00cae4 OUTLINED_FUNCTION_38 + 2171988 15 SwiftUI 0x00000001ad0eacc4 objectdestroy.127Tm + 5004 16 SwiftUI 0x00000001ae4045e0 OUTLINED_FUNCTION_2 + 31536 17 SwiftUI 0x00000001ad0084cc OUTLINED_FUNCTION_38 + 2154044 18 SwiftUI 0x00000001acff47b8 OUTLINED_FUNCTION_38 + 2072872 19 SwiftUI 0x00000001ad17aa28 objectdestroy.2265Tm + 6976 20 AttributeGraph 0x00000001aea237a4 _ZN2AG5Graph11UpdateStack6updateEv + 512 21 AttributeGraph 0x00000001aea23fe0 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 424 22 AttributeGraph 0x00000001aea32828 _ZN2AG8Subgraph6updateEj + 848 23 SwiftUI 0x00000001ae32a2dc OUTLINED_FUNCTION_5 + 12088 24 SwiftUI 0x00000001adc8b68c OUTLINED_FUNCTION_10 + 6360 25 SwiftUI 0x00000001ad58fd6c OUTLINED_FUNCTION_58 + 1312 26 SwiftUI 0x00000001ad58fc34 OUTLINED_FUNCTION_58 + 1000 27 libswiftObservation.dylib 0x0000000222ed8558 $s11Observation0A8TrackingV08_installB0_7willSet03didE0yAC_yACYbcSgAGtFZAC2IdOAC5EntryVXEfU_yyYbcfU2_TATm + 48 28 libswiftObservation.dylib 0x0000000222ed8670 $sIegh_ytIeghr_TRTA + 28 29 libswiftObservation.dylib 0x0000000222ed682c $s11Observation0A9RegistrarV7ContextV7willSet_7keyPathyx_s03KeyG0Cyxq_GtAA10ObservableRzr0_lFTf4dnn_n + 568 30 libswiftObservation.dylib 0x0000000222ed725c $s11Observation0A9RegistrarV7willSet_7keyPathyx_s03KeyF0Cyxq_GtAA10ObservableRzr0_lFTf4dnn_n + 60 31 libswiftObservation.dylib 0x0000000222ed2158 $s11Observation0A9RegistrarV12withMutation2of7keyPath_q0_x_s03KeyG0Cyxq_Gq0_yKXEtKAA10ObservableRzr1_lF + 80 32 TestSearchStringInViewModel 0x000000010018dbf4 $s27TestSearchStringInViewModel0eF0C12withMutation7keyPath_q_s03KeyJ0CyACxG_q_yKXEtKr0_lF + 284 33 TestSearchStringInViewModel 0x000000010018d5b8 $s27TestSearchStringInViewModel0eF0C06searchC0SSvs + 156 34 TestSearchStringInViewModel 0x000000010018d504 $s27TestSearchStringInViewModel0eF0C06searchC0SSvpACTk + 88 35 libswiftCore.dylib 0x000000019198c560 $ss26NonmutatingWritebackBufferCfD + 312 36 libswiftCore.dylib 0x0000000191bbddb0 _swift_release_dealloc + 56 37 libswiftCore.dylib 0x0000000191bbea8c _ZN5swift9RefCountsINS_13RefCountBitsTILNS_19RefCountInlinednessE1EEEE15doDecrementSlowILNS_13PerformDeinitE1EEEbS3_j + 136 38 libswiftCore.dylib 0x000000019198dd2c swift_setAtReferenceWritableKeyPath + 244 39 SwiftUI 0x00000001ad28b210 OUTLINED_FUNCTION_7 + 1520 40 SwiftUI 0x00000001ad28b32c OUTLINED_FUNCTION_7 + 1804 41 SwiftUI 0x00000001ae27b25c OUTLINED_FUNCTION_1 + 9376 42 SwiftUI 0x00000001ad28b128 OUTLINED_FUNCTION_7 + 1288 43 SwiftUI 0x00000001adb31b08 OUTLINED_FUNCTION_0 + 1256 44 SwiftUI 0x00000001ae49dac8 objectdestroy.2Tm + 3400 45 SwiftUI 0x00000001adb31b08 OUTLINED_FUNCTION_0 + 1256 46 SwiftUI 0x00000001adb33b6c OUTLINED_FUNCTION_0 + 9548 47 SwiftUI 0x00000001adb31b08 OUTLINED_FUNCTION_0 + 1256 48 SwiftUI 0x00000001adb32f34 OUTLINED_FUNCTION_0 + 6420 49 SwiftUI 0x00000001adb332dc OUTLINED_FUNCTION_0 + 7356 50 SwiftUI 0x00000001adb31b08 OUTLINED_FUNCTION_0 + 1256 51 SwiftUI 0x00000001adb32f34 OUTLINED_FUNCTION_0 + 6420 52 SwiftUI 0x00000001adb332dc OUTLINED_FUNCTION_0 + 7356
1
0
364
Jan ’24
Submitting visionOS apps to TestFlight: "Invalid Provisioning Profile"
I understand from the Xcode release notes that it is now possible to submit visionOS apps to TestFlight. I'm getting the error "Asset validation failed" "Invalid Provisioning Profile. This provisioning profile is not compatible with visionOS apps". when uploading to TestFlight. I use an Xcode managed profile, and am using the same bundle id as for the iOS and Mac versions of the app. In the "Certificates, Identifiers &amp;amp; Profiles" -&amp;gt; "Edit your App ID Configuration" it lists "iOS, iPadOS, macOS, tvOS, watchOS, visionOS" under "Platform". Is there some guidance on submitting visionOS apps to TestFlight? Any ideas on how to regenerate the profile to include visionOS apps? Thanks, Damian
2
1
1.7k
Aug ’23
Error -34018 calling SecItemCopyMatching (no group)
Hi, I'm getting the error code -34018 in the VisionOS simulator when calling SecItemCopyMatching with this query: let getquery: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: name, kSecReturnData as String: kCFBooleanTrue!, kSecMatchLimit as String : kSecMatchLimitOne ] The console says: copy_matching Error Domain=NSOSStatusErrorDomain Code=-34018 "Client has neither application-identifier nor keychain-access-groups entitlements" UserInfo={numberOfErrorsDeep=0, NSDescription=Client has neither application-identifier nor keychain-access-groups entitlements} I'm NOT using groups. I've tried changing the bundle id. Xcode version 15.0 beta 2 (15A5161b) Anyone have any ideas? Anyone using the keychain in their visionOS app? :-)
2
0
1.1k
Jul ’23
onAppear not called for view in a List in a TabView on WatchOS
For the following code, the "Appeared..." label only gets displayed for the elements that are initially visible, when others are scrolled into view the onAppear does not get called on WatchOS. It just shows Appeared 1 Appeared 2 Appeared 3 Appeared 4 Appeared 5 Not appeared Not appeared Not appeared Not appeared ... even when the "Not appeared" elements are scrolled into view. struct PagesView : View {   var body : some View {     TabView {       List {         ForEach(Array(1...10), id: \.self) { v in           Row(number: v)         }       }     }   } } struct Row : View {   let number : Int   @State var label = "Not appeared"   var body : some View {     Text(label)       .onAppear {         label = "Appeared \(number)"       }   } } Does anyone know why this might be happening?
0
0
870
Oct ’20
Embedded watch video within iphone app + referring to trademarked terms
I have an app that is already in the store, - https://apps.apple.com/us/app/watchgit/id1515780045 that lets you use GitHub on your Apple Watch (yes really!). I submitted a bugfix update with no changes other than to fix a crash on launch on the Apple Watch, and my update was rejected. I have a phone app which I use to facilitate login, since logging in to GitHub on the Apple Watch isn't feasible. The phone app does nothing except let you login and logout. Because the app store only lets you show videos of phone apps, I embed within the phone app's home page (the only page) a video of the watch app in action. That way I can upload a video of the phone app to the store and people get to see the watch app in action. Despite being accepted the first time, the update was rejected for two reasons: Guideline 2.3.4 - Performance - Accurate Metadata Your app preview includes content that does not sufficiently reflect the app in use. Specifically, your preview: Includes device images and/or device frames. Next Steps To resolve this issue, please revise your app preview to only use video screen captures of the app, narration, and textual and design overlays. Resources For resources on creating great app previews, you may want to review the App Previews page. For more general information on how to make the most of your app's App Store product page, please see the App Store Product Page information available on the Apple Developer website. Guidelines 2.3.7 - Performance - Accurate Metadata We noticed that your app name or subtitle to be displayed on the App Store includes the following trademarked term or popular app name, which is not appropriate for use in these metadata items. Specifically, your app name or subtitle included the term, GitHub. The next submission of this app may require a longer review time, and this app will not be eligible for an expedited review until this issue is resolved. Despite my iPhone preview videos being exactly the same as the app's screen, with no manipulation or framing, it appears that they don't like the fact that I have embedded a video of the watch app within the iPhone app's screen. Also, because my app is a client for the GitHub service I need to state that in some way, but I have no idea as to what formulation of text, if any, would be acceptable. Questions: Does anyone have any guidance as to what I should do about the embedded video situation? Do I just give up on trying to show the watch app in action within the home screen of the iPhone app? Does anyone have any idea how I might refer to GitHub without being flagged for trademark violation? You can see the video and text in question in the app store: https://apps.apple.com/us/app/watchgit/id1515780045 I've updated the app and description to try to address the use of GitHub with a disclaimer and saying "for the GitHub service" but was rejected in the same way. My explanation that the iPhone video was an accurate reflection of the screen was also rejected: Regarding Guideline 2.3.4 - Performance - Accurate Metadata, we continue to find that the rejection is valid. Specifically, your preview includes device Images. To resolve this issue, please revise your app preview to only use video screen captures of the Watch app.
2
0
1.1k
Sep ’20
Text specifier gives different results on real device vs simulator
I'm using Xcode 12 beta 2, and the latest WatchOS beta. For the following code I see 02:03 (correct) in the simulator and preview, and 02:00 (incorrect) on the physical watch: import SwiftUI struct ContentView: View {   var body : some View {           VStack {       let a = 2       let b = 3       Text("\(a, specifier: "%02d"):\(b, specifier: "%02d") ")     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } Is this a known issue, user error, or a bug? Thanks, Damian
1
0
578
Jul ’20