Post

Replies

Boosts

Views

Activity

Location Simulation not working in Xcode 10 and iOS 12
I am developing an app that uses GPS. In the simulator I always used the location simulation feature of Xcode which always worked for me. I selected the Debug - Location - Freeway Drive option in Xcode 10. Whenever I select some preset to simulate, Xcode shows the following error:[Client] #Spi, InterruptedGPS is enabled on the simulated device and the app has permission to access the GPS. I already tried to restart the simulator multiple times, selected another device, but no device works. Does anyone have a solution to this?Regards
5
0
12k
Oct ’18
Side bar background has weird effect on Big Sur
I am trying to adopt the new MacOS Big Sur sidebar style in one of my apps. Previously I chose a source list and added the items to it which worked fine. I have selected the new template Window Controller with Sidebar in Xcode. When I run the project without adding any items or controls, it looks fine. However, if I add the Source List, the background of the side bar has some weird effect. It seems like the Column of the Source List messes up the background. How can I add items to a sidebar on MacOS Big Sur? I am running Xcode 12 beta 3 and the latest beta 3 of MacOS Big Sur - 11.0 Beta (20A5323l). Unfortunately I can not post a screenshot.
0
0
618
Aug ’20
Custom NSToolbarItem has different hover effect
Hello, I have created a new macOS project. I dragged a NSToolbar onto my NSWindow and then I added a custom NSToolbarItem. I then added an outlet for the item and connected my IBAction to the button (so the button is no longer disabled). I have selected a symbol image for the custom item. When I start my app, the default Fonts and Colour items use the new hover effect (where the background is being coloured differently). However, my custom item does not have this effect. The colour of the image is adjusted instead. I know that I can achieve this effect by using a NSButton instead but I was wondering if I can achieve this effect with a NSToolbarItem.
1
0
1.3k
Aug ’20
WidgetKit UI that refreshes constantly (like Clock)
Using the TimelineProvider I am only able to update my UI every five minutes. Is it possible to update my app more frequently (like every five seconds)? Although I set the next update to five seconds, it seems like the minimum is five minutes. Is there any possibility to detect when the app becomes active (i.e. is not in the background)? Does the new lifecycle offer such possibilities? My plan is to start a timer once the app becomes active (and disable the timer once the widget is no longer visible).
0
0
645
Aug ’20
I ran out of Developer ID Certificates - Second Developer Account?
Hello, I ran into a big problem for which I don't know how to proceed. Every developer can create up to five Developer ID certificates. Those certificates are used if you want to release your app outside the Mac App Store. I have an app on the Mac App Store that also offers a helper application, which is downloadable on my homepage. I have created a new version of this helper application and wanted to send it to the notarization service of Apple. Xcode displayed an error that I do not have a valid Devloper ID certificate (because the private key is missing) and I can not create a new one because I already created five certificates. I can download the certificates without problem, but I can not get the private key. At least one developer certificate was created on my machine, but It does not seem to work. Because I assumed that there is no way of getting these certificates back (always create backups!), I contacted Apple to see if they are willing to revoke any old certificates so I can create a new one (I know that at least the first two certificates are not being used, so they could be revoked, but Apple does not revoke old certificates). Right now, Apple decides whether they grant me an exception to create additional certificates. Let's assume Apple declines this request...what can I do? Can I create a second developer account? I don't care about the 99€, but it does not seem that this is allowed. Big Sur will be released tomorrow and I really need to sign this app. And yes, I know that I should keep a backup copy of my private keys in the future ;) Is there anything I can do (especially if Apple declines the request)? Any help is highly appreciated. Kind Regards, Sascha
5
0
3.0k
Nov ’20
App Store does offer Update for App that can not be used any longer
Hello, I have a couple of apps that are available on the Mac App Store. With the latest update I increased the minimum required version to 11.0. However, I have been getting a lot of negative feedback because on Catalina the App Store will show that an update is available. However, once the user updates the app, it will no longer run (in some cases the user can not update, but then the App Store will always show an update badge which can also ne frustrating). Is this a known bug? is there anything I can do? Regards, Sascha
1
0
710
Nov ’20
When calculating upload speed, ifaddrs.ifa_data.ifi_obytes contains wrong value
Hello, I am trying to calculate the upload speed of my WiFi network adapter. I have noticed that the value for the sent bytes (upload) is always double the expected value. I am running a speediest and my downstream is 30Mb/s. However, my upload speed in my app shows a little less than 8 MB/s which is actually double the value (it should be approx. 4MB/s). Playground - https://developer.apple.com/forums/content/attachment/63d94243-0f1b-426d-97bf-86a0be2dfe58 This issue can be reproduced with the attached Playground. What could be the reason for this? It does not happen with Download speed.
3
0
1.3k
May ’21
Creating new text file using Finder Sync API results in deny(1) file-write-create Sandbox error
I am trying to develop an application that also contains an extension for the Finder. The extension can be used to create a new text file at the current Finder location. I have only added the following permissions to the entitlements file for both the main app and the extension: com.apple.security.files.user-selected.read-only I have implemented the FIFinderSync protocol in my extension. I added a menu item to create a new text file. Whenever I execute this method, the following error is shown in the Console: Sandbox: Extension(4032) deny(1) file-write-create /Users/username/Documents/New Text.txt The simplest way to get around this error is to add the following key: com.apple.security.temporary-exception.files.home-relative-path.read-write However, applications using this entitlement will be rejected during app review. The extension is initialised with this code: FIFinderSyncController.default().directoryURLs = [URL(fileURLWithPath: "/")] How can I prevent this error to be thrown? I could use security scoped bookmarks, open a dialog and then save this bookmark. However, I have tested plenty of extension available in the App Store and none of them have shown any NSOpenPanel, the files have been created without any problems. Any help is appreciated.
5
0
1.9k
Aug ’21
I accidentally created an iOS version of my app in App Store COnnect - How do I delete it?
Hello, I have a macOS app that is available on the Mac App Store. Yesterday I wanted to copy the link of my app. I opened App Store Connect which was still loading. I saw the correct link and clicked it. However, just in the moment when I clicked it, the page layout changed and the link became the link "Create iOS app". HOw I have my macOS build that is released and a new iOS version 1.0 for my app. I can not delete the iOS version. Is it possible or do I have to live with a useless build that will anooy me for the next couple of years? Regards
1
0
901
Sep ’21
App Store Connect API is very slow
I am using the App Store Connect API to receive information about my app. I have noticed that the API is so extremely slow. Are there any tipps to speed up the requests? Take this request for example: https://api.appstoreconnect.apple.com/v1/builds?filter[app]=1234854699&limit=1&fields[builds]=iconAssetToken To me, this seems like a pretty straightforward request. Out of all build, get the latest one and return it. However, this request takes between 3 and 5 seconds. I need to send this request for each of my apps, so getting the builds alone can take up to 20 seconds which is not acceptable. Other requests are very slow as well. For simple requests like that I expect response times within a couple of hundreds milliseconds. Am I missing something? I have used Postman to send the request. I did not send any additional headers, only the Authorisation one.
3
1
3.2k
Oct ’21
CoreBluetooth stopped working in my app
Hello, I am the developer of an app that is published on the App Store. This app connects to Bluetooth devices to read their battery levels. However, it seems that CoreBluetooth, which is used to discover and connect to devices, has completely stopped working on macOS Monterey. The delegate methods are no longer triggered. When I start my app I see the following messages in the output area: [CoreBluetooth] No name or address The Console app shows a lot of this messages: error 14:56:23.730415+0200 bluetoothd Server.Core sdp attributes is empty I don't know if this is related in any case. Are there any new entitlements or something like that? I did not change any single line and on Big Sur, everything works fine. A customer of mine, which also uses the beta version, already contacted me, so this seems to be a general issue - at least with my app? The app also works fine on Big Sur for the customer.
4
0
4.7k
Oct ’21
Disable cacheing before reading from a file using Swift
Hello, I am trying to implement some sort of minimal I/O benchmarking feature. I can calculate the write speeds with the following code: guard var handle = FileHandle(forUpdatingAtPath: url.path) else { return } var writtenData: UInt64 = 0 var totalWrittenData: UInt64 = 0 var writeSpeed: UInt64 = 0 let data = Data(repeating: 0, count: 16 * 1024 * 1024) // 16 MB test block let startTime = Date.now.timeIntervalSince1970 while Date.now.timeIntervalSince1970 - startTime < 5.0 { handle.write(data) try? handle.synchronize()self.totalWrittenData += blockSize let duration = Date.timestamp - self.startTime writeSpeed = UInt64(Double(self.totalWrittenData) / duration) if writtenData > blockSize * 16 { writtenDara = 0 try? handle.seek(toOffset: 0) } } // On my PCE-Express SSD this results in roughly 1800MB/s. This value matches the value reported by other benchmarking apps. // Remove everything at the end of the file try? handle.truncate(atOffset: blockSize) try? handle.synchronize() try? handle.seek(toOffset: 0) var index = 0 while index < 5 { autoreleasepool { var startTime = Date.timestamp let bytes = try? handle.readToEnd() let duration = Date.timestamp - startTime          Swift.print(bytes?.count, duration) try? handle.seek(toOffset: 0) } index += 1 } The code works - in theory. Although I really like that the operating system and drivers do some cacheing to optimise performance - in my use case I don't want files to be cached. The read results are always around 8GB/s for my PCE-Express SSD and also for some older USB Sticks, so the data seems to come directly from the memory. I found a couple of other threads which led me to some older C functions, specifically this code: // Open file. let fd = fopen(fileUrl.path, "r") // Find the end fseek(fd, 0, SEEK_END) // Count bytes let fileByteSize = ftell(fd) // Return to start fseek(fd2, 0, SEEK_SET) // Disable cache setvbuf(fd2, nil, _IONBF, 0) // Find the end fseek(fd2, 0, SEEK_END) let readBytes = fread(pointer, 1, fileByteSize, fd2) readBytes += UInt64(readBytes.count) When executing this code (or parts of it), it also works fine - but the data is also coming from the cache. What am I missing? I also tried the FileManager. Of course I am not an expert, however I think that the FileManager is "just" a wrapper around all those C functions. Is there any way to ignore the cacheing mechanism and tell macOS / the driver to read the data directly from the drive? Regards, Sascha
3
0
1.3k
Feb ’22
Can not get FileHandle on MS-DOS file systems: The operation couldn’t be completed. Operation not permitted
Hello, I am trying to get a FileHandle for a specific file on an external hard disk. My app is sandboxed and in order to be able to get a FileHandle I am showing a NSOpenPanel so the user can grant permission to access this disk. After the user has granted permissions, I use the following code to get the handle: guard let readDescriptor = try? FileDescriptor.open(readUrl.path, FileDescriptor.AccessMode.readWrite) else { return } I get the following error when this code runs: The operation couldn’t be completed. Operation not permitted What I don't understand is the fact that this code only fails on disks that have the MS-DOS file system. I have tested various USB sticks, SD cards and external hard drives. It works fine for the APFS, but once I format the device as MS-DOS, the code fails. Has anyone any idea why that is? Regards, Sascha
3
0
1.3k
May ’22
Porting existing LoginItem Logic to the new SMAppService
Hello, I have many apps that use LoginItem logic to enable the auto start. I always used the function SMLoginItemSetEnabled to enable or disable the launch of the LoginItem. I am using macOS Ventura Beta for quite some time now and I noticed that whenever I launch one of my apps, a message appears. It says that my app added some functions. When I click on the message, the Login Items section of the System Preferences opens and my recently opened app is listed under "Allow in the Background". I want to port my apps to the new logic but I am not quite sure how to do that. I don't want my apps to appear under the "Allow in the Background" section but rather in the "Open at Login" section. I am using the following code to enable or disable the auto start under macOS 13.0+: if autoLogin { try? SMAppService.mainApp.unregister() } else { try? SMAppService.mainApp.register() } This works very well. If I check my switch, the app appears under the "Open at Login" section. If I disable the switch, the app disappears from this list. Great, this is what I want. However...when I restart my Mac, the app is launched automatically. And now there is a new entry in the "Allow in the Background" section again. What am I doing wrong? Should I register or unregister the LoginItem instead? This is not really what I want, it appears in the wrong section and I think this is confusing for users. I read somewhere else that the user consent is stored, even when resetting with sfltool or something like that. Does the item appear in this section (and is launched automatically) because I launched the app earlier without my new logic? Is this simply a bug? has anyone a working example of how to properly support auto launching an application under macOS Ventura and earlier versions? Regards, Sascha
6
0
3.0k
Sep ’22
Xcode creates schemes for some referenced Swift Packages
Xcode always creates targets /schemes for referenced Swift packages. In my app there are 14 Swift packages that are referenced. My app itself has two targets (app and an auto launcher) and Xcode creates targets for two schemes. I don't understand why those schemes are created (and why not for every package). Is there any way to disable this feature? Can someone explain why Xcode creates schemes for referenced Swift packages? I deleted the schemes several times, but Xcode simply recreates them.
3
1
1.9k
Sep ’22