Post

Replies

Boosts

Views

Activity

Permission issue accessing Reminders through EventKit in MacOS app
Hello, I have an app that I would like to have read and write access to Reminders using EventKit, but on MacOS 14 (14.2.1) when I call requestFullAccessToReminders I get error = nil, success = false (even when access is granted) and there is no permission prompt to use user when access has not yet been granted. Note this is not an issue in iOS. Here's a stripped down example of what I'm talking about import EventKit struct ContentView: View { let store = EKEventStore() @State var permissionState = "Ready to Request" var body: some View { VStack { Text(permissionState).font(.title) Button("Request Access") { requestFullAccessToEvents() }.padding() } .padding() } func requestFullAccessToEvents() { store.requestFullAccessToReminders { (granted, error) in if let foundError = error { permissionState = "Error: " + foundError.localizedDescription } else if granted { permissionState = "Permission Granted" } else { permissionState = "Permission Denied" } } } } then the plist <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSRemindersFullAccessUsageDescription</key> <string>something meaningful</string> </dict> </plist> I managed to find an error in the log saying Received error from calaccessd connection: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.CalendarAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.CalendarAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}. Attempting to call any reply handler. So in the Signing & Capabilities tab I added Calendars to the App Sandbox, and that seemed to fix the issue, after that the user gets prompted for access to Reminders as expected or gets access depending on the access granted. Then I tried to release the app and I got rejected from the App Store because my app isn't using calendars, but of course I'm asking for access in the sandbox. So is this the wrong way to get permission for access, and if so, what is the correct way? Thanks!
1
0
766
Feb ’24
@available(iOS 15.0, *) crashing on iOS 14.8 in TestFlight
I'm having an issue where iOS devices running iOS 14 are crashing, at first it was happening on the first view, so I decided I could probably live without the functionality and removed it, which worked, but then the same error happened in the next screen (one from a Sheet, the other from a NavigationView). I am unable to reproduce the error on physical devices deployed directly from Xcode (13.2 and 13.3) or in the simulator. One of the instances is the following (I stripped some things out for simplicity, just to show how I'm using it) struct TimeView: View { @State var time: Double var body: some View { VStack{ if #available(iOS 15.0, *) { TimeEditorView } else { TimeEditorView14 } } @available(iOS 15.0, *) var TimeEditorView: some View { TextField(Constants.Times.emptyTextHours, value: $time, format: .number) .keyboardType(.decimalPad) } var TimeEditorView14: some View { Text("\(time)") } } Since it's completely different code in different places, I'm thinking maybe it's a bug or a project setting or something like that (if I am using it wrong I would think it would crash locally). #0 (null) in closure #1 in TimeView.body.getter () #1 0x0000000102bdb190 in init at #2 (null) in body.get () #3 (null) in protocol witness for View.body.getter in conformance TimeView () #4 (null) in partial apply for closure #1 in ViewBodyAccessor.updateBody(of:changed:) () #5 (null) in closure #1 in BodyAccessor.setBody(_:) () #6 (null) in ViewBodyAccessor.updateBody(of:changed:) () Any suggestions of things to try are welcome, thanks! Edit: corrected the second view variable name
1
0
908
Apr ’22
Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444
I'm trying to present the items of an array in multiline text by looping over them in a ForEach. I need them to be able to be deleted, reordered and edited. I'm getting the index out of range error when I try to delete any of the items, and it's getting thrown in the AppDelegate (I tried stepping through to see where it was). If I replace the TextEditor with a regular text field I can delete without issue (TextField also crashes). It seems like the loop is throwing the error instead of updating the array? I can pass in the text as a constant and it doesn't crash, but then I can't edit it. Here is a simplified version of my code that I created to troubleshoot the issue. struct ContentView: View {   @State private var editMode: EditMode = .active   @State var array = ["one", "two", "three", "four"]       var body: some View {               List{         ForEach (0..<array.count, id: \.self) { index in           //Text(array[index])           //TextField("", text: array[$0])           TextEditor(text: $array[index])         }         .onDelete { indexSet in           let removeIndex = Int(Array(indexSet).first!)           array.remove(at: removeIndex)         }       }     } } I created another View that takes in the unbound value and displays it in a TextEditor, but I feel like that's not a good solution. I am new to Swift, so maybe I'm missing something simple? Is this how I should be creating this screen to do what I want in SwiftUI? Thanks!
4
1
7.4k
Dec ’20
Error: Unable to boot the Simulator
I'm having an issue that I can't quite figure out. I'm new to Swift and Xcode, I set up Xcode last week and it worked fine all week.Then today I started getting an issue when I click on any storyboard in any project where it takes aprox 20 seconds of spinning before it loads and a long time when I try to change anything. The projects I created last week don't display properly anymore, no images, text fields resized to be unreadable. I even made a hello world project and added just one object (I tried different types) and I still get "Internal error occurred. Editing functionality maybe limited" and the link to report a bug has no file. When I try to build the project the project succeeds, but I get the following error:DetailsUnable to boot the Simulator.Domain: NSPOSIXErrorDomainCode: 60Failure Reason: launchd failed to respond.--System InformationmacOS Version 10.15.4 (Build 19E287)Xcode 11.4.1 (16137)When I try to build selecting my iPhone and putting in my team, it says device not available (however I did not try this last week).I tried restarting my computer, I tried reinstalling Xcode and deleting files, but I clearly missed some because when I started up it opened the last project I had open befre I deleted. I tried resetting the NVRAM. I tried cleaning the build folder. I tried deleting the derived data. I tried deleting and reinstalling all the simulators.The only thing I can think of that would be different from last week is I changed my Apple ID login, but I'm not even using a developer license yet, I'm just trying to use the simulator and was leaving it blank, so I wouldn't *think* that would matter.Any suggestions woule be greatly appreciated, thanks!Edit: I deleted Xcode and tried installing Xcode 10.2.1 and still having the same issue
5
0
5.3k
May ’20