Post

Replies

Boosts

Views

Activity

@Environment(\.dismiss) causes endless loop in iOS 18.2.1
Hello, I've been using the @Environment(\.dismiss) var dismiss in a SwiftUI app for the last 2 years which means it was working as expected in iOS 16, iOS 17 and for the most part iOS 18 up until iOS 18.2.1 in which it is causing an endless loop and eventually a crash. It seems to be something about using a the @Environment(\.dismiss) with a NavigationLink which seems to cause this issue. When I add a log in my swiftUI views with let _ = Self._printChanges(), I see the following printed out in a loop: CurrentProjectView: _dismiss changed. SurveyView: @self changed. Similar issues have been reported: https://forums.developer.apple.com/forums/thread/720803 https://forums.developer.apple.com/forums/thread/739512 Any idea how to resolve this ?
1
0
304
Jan ’25
MPMediaItemPropertyArtwork not getting set in Apple Watch
I have an audio streaming app which plays live streams using AVPlayer. Everything works as intended and in order to support a good user experience, I set the MPNowPlayingInfoCenter's nowPlayingInfo property with the title, artist and artwork - here is a small snippet: func updateNowPlayingView(withSong song: Song) { let songImage = song.getSongImageAsUIImage() let artwork = MPMediaItemArtwork(boundsSize: songImage.size) { size -> UIImage in let resizedImage = songImage.imageWith(newSize: size) return resizedImage } MPNowPlayingInfoCenter.default().nowPlayingInfo = [MPMediaItemPropertyTitle: song.getSongName(), MPMediaItemPropertyArtist: song.getSongArtist(), MPNowPlayingInfoPropertyIsLiveStream: true, MPMediaItemPropertyArtwork: artwork] } This function is called in the CarPlay Scene delegate and it is called in my AVPlayer sub class for my iOS app and I successfully see the correct meta data in the Command Centre, Lock Screen and Car Play. For some reason, the artwork does not get displayed in my Apple Watch's Now Playing App Seems like it is setting the default / placeholder music icon image. However, when I play the Apple Music App, I can see they set the Now Playing artwork properly So what am I doing wrong that my artwork does not get set for Apple Watch ? Am I setting it from the wrong place in my code base ? Or do I need to keep an Apple Watch app / Extension / Scene like CarPlay to send NowPlaying data to the Apple Watch Now Playing app ? Thanks for your time
0
0
847
Jun ’21