Post

Replies

Boosts

Views

Activity

Create Widget for iOS 14 with Xcode 15.3
Hi all, I am experimenting with Widgets and I would like to add to my SwiftUI app a Widget that can be run on iOS 14. My Mac has macOS Sonoma 14.4, I am using Xcode 15.3. My SwiftUI app can target back to iOS 14. When adding a Widget with Xcode 15.3, the Widget can only target iOS 17. If I downgrade the minimum iOS version of the Widget extension, then my project doesn't compile anymore. I have tried multiple attempts to solve this problem. All of them have failed. If would be nice if someone could give me help on one or more of them: I have tried to install Xcode version 12.5.1, but apparently it is not possible on Sonoma. (It gets installed, but then I get an error on the first execution) I have tried to install a virtual machine in Parallels with macOS Big Sur, but I wasn't able to find the IPSW installation file from the Apple developer downloads. I have created a widget with Xcode 15.3, then replaced the files with the content of a new widget found in a YouTube video, and modified the project.pbxproj inside the xcodeproj as in the attached file (essentially I have added WidgetKit as a framework with an older version, that doesn't require iOS 17) Now: the full app compiles I can test the widget in the Xcode preview I can't deploy the app on both my iPhone with iOS 17.4, and on a Simulator with iOS 15. As I am not expert, probably I miss many steps or I have done many errors. Can anyone please help me in adding an iOS 14 Widget on Xcode 15.3 on Sonoma?
1
0
843
Mar ’24
How backup certificate
Hi, I have upgraded my Mac to Sonoma and for some reason I get lost now when backup up a certificate. As I wasn't able to import my old certificate (exported as p12, but this is another issue) I started from scratch. I have created from KeyChain a new CertificateSigningRequest. Then I've uploaded it to the Apple Developer Portal and created a new certificate, that I have successfully downloaded as cer file. Now, I would like to save the certificate, including the private key. From KeyChain, I don't get a Reveal option to be able to export the private key of my certificate. Was it available in old versions of KeyChain, and now not anymore? Or my certificate doesn't have the private key? (imo this doesn't make sense at all) So I right click on the certificate but I can't export as p12 file, with the private key: Can please anyone refer me to the official documentation about this? (I have searched for it, but unable to find anything)
2
0
755
Jan ’24
AudioSession output questions
Hi, I am developing a POC music player app. I use AVAudioSession; I have implemented background music and integration with command center. I am focusing now on volume. I am able to receive volume changes, with systemVolumeDidChange. About setting the volume, I am able to set it using MPVolumeView, but not for remote wifi audio device (for example, HomePods). I have the following open points: the native Podcast app is able to control volume when connected to HomePods. How does it do? the native Podcast app has icons for AirPods, HomePods, even Car bluetooth. Are there icon propeties for audioSession.currentRoute.outputs? Or what should I use instead? Here an example of what I would like to achieve:
0
0
642
Jun ’23
UrlSession.shared.data returns "The network connection was lost."
I have created a POC to implement various types of download in SwiftUI. The project is available at https://github.com/curia-damiano/SwiftUIDownloader. This project has always worked, but for some reasons it doesn't work anymore. The app downloads files like https://speed.hetzner.de/100MB.bin; if I try to another files, for example https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_5MG.mp3, it still works perfectly. The error that I get is: 2023-04-16 18:42:20.665139+0200 SwiftUIDownloader[10442:425026] Task <54E67F7F-7822-4429-9943-12DA94DDCB27>.<1> HTTP load failed, 446/0 bytes (error code: -1005 [4:-4]) 2023-04-16 18:42:20.666751+0200 SwiftUIDownloader[10442:425023] Task <54E67F7F-7822-4429-9943-12DA94DDCB27>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x6000015a3930 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x60000382c730 [0x1bbb34418]>{length = 16, capacity = 16, bytes = 0x100201bb58c6f8fe0000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <54E67F7F-7822-4429-9943-12DA94DDCB27>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <54E67F7F-7822-4429-9943-12DA94DDCB27>.<1>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://speed.hetzner.de/100MB.bin, NSErrorFailingURLKey=https://speed.hetzner.de/100MB.bin, _kCFStreamErrorDomainKey=4} I've also tried to troubleshoot the UrlSession, but then from the Console app I don't get any clear information about the cause of the error. I've also tried the app on old iPhone that had old builds of the app, and they have this error now - so I am sure that it is something that has changed on the server. Can anyone please help me in understanding what I can change to make the download to work again?
9
0
3.2k
Apr ’23
Sync closure needs to wait for async code
I am developing an app that uses MPRemoteCommandCenter to control audio reproduction from the lock screen. The code is inside a @MainActor view-model, part of a SwiftUI project. The initial code that I need to incorporate is: commandCenter.playCommand.isEnabled = true commandCenter.playCommand.addTarget { [unowned self] event in if !self.isPlaying { self.playOrPause() return .success } return .commandFailed } I have tried this: commandCenter.playCommand.isEnabled = true commandCenter.playCommand.addTarget { [unowned self] event in return await MainActor.run { if !self.isPlaying { self.playOrPause() return .success } return .commandFailed } } But still it doesn't compile. I understand why: the callback method is not marked to be async. Still it expects a value, that I can return only from async code, because I need to wait to re-enter into the main thread. Can anyone please help me?
1
0
720
Feb ’22