Hi all,
I ma displaying the Music Subscription offer sheet in my app. Shortly after the sheet is presented, when the user dismisses the offer, the app crashes with error:
Fatal error: CloudServiceSetupView.makeUIViewController() was called with an unexpected presentation state: idle.
2021-11-30 11:56:28.974626-0800 AppName[16276:4525658] _MusicKit_SwiftUI/CloudServiceSetupView.swift:31: Fatal error: CloudServiceSetupView.makeUIViewController() was called with an unexpected presentation state: idle.
What am I doing wrong?
Related Ticket for Apple Engineers: FB9789040
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi all,
I am trying to understand how to show the AirPlay menu in SwiftUI. My goal is to show the AirPlay menu, the same one displayed in the music app, but programmatically from a SwiftUI Button.
I was able to display the AirPlay menu using UIViewRepresentable and MPVolumeView, but that does not show the currently active AirPlay speakers (no checkmarks).
So how can I:
Show the AirPlay button from a custom SwiftUI button?
Show the same AirPlay menu as the one in the Music app, with preselected active speaker?
Hi all,
I am trying to display the name of the group in the subtitle of the communication notification, like this:
Here is my code:
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
var personNameComponents = PersonNameComponents()
personNameComponents.nickname = "Test Person"
let avatar = INImage(url: URL(string: "https:imageURL")!)
let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Test Person", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)
let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)
let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .unknown, content: "Test", speakableGroupName: INSpeakableString(spokenPhrase: "Test Group"), conversationIdentifier: "Test Group", serviceName: "Test", sender: senderPerson, attachments: nil)
incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)
let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)
interaction.direction = .incoming
do {
let newContent = try request.content.updating(from: incomingMessagingIntent) as! UNMutableNotificationContent
contentHandler(newContent)
} catch {
print(error)
}
}
I also have tried:
Setting the subtitle of the UNMutableNotificationContent
Including the subtitle field in the aps remote notification payload
When I display the notification as a normal notification the subtitle is displayed as usual. What am I doing incorrectly?
Hi all,
I am trying to implement the communication notification for me app. But the avatar does not show and there is virtually no difference from a normal notification.
I also added the Communication Notification capability, and in my Notification Service Extension's Info.plist, added this: NSExtension → NSExtensionAttributes (dictionary) → IntentsSupported (array) → INSendMessageIntent (string)
What am I doing wrong?
Here is my code:
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
var personNameComponents = PersonNameComponents()
personNameComponents.nickname = "Sender Name"
let avatar = INImage(named: "Cover")
let senderPerson = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: personNameComponents, displayName: "Sender Name", image: avatar, contactIdentifier: nil, customIdentifier: nil, isMe: false, suggestionType: .none)
let mePerson = INPerson( personHandle: INPersonHandle(value: "1233211232", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true, suggestionType: .none)
let incomingMessagingIntent = INSendMessageIntent(recipients: [mePerson], outgoingMessageType: .outgoingMessageText, content: "Test DUde", speakableGroupName: nil, conversationIdentifier: "uid", serviceName: "caset", sender: senderPerson, attachments: [])
incomingMessagingIntent.setImage(avatar, forParameterNamed: \.sender)
let interaction = INInteraction(intent: incomingMessagingIntent, response: nil)
interaction.direction = .incoming
do {
let newContent = try request.content.updating(from: incomingMessagingIntent)
contentHandler(newContent)
} catch {
print(error)
}
}
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
contentHandler(bestAttemptContent)
}
}
}
Hi there,
I would like to make the navigation bar clear in my view.
Currently I am using the init() method to achieve this:
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: UIBarMetrics.default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().tintColor = .clear
UINavigationBar.appearance().backgroundColor = .clear
But this makes the navigation bar clear app-wide.
How can I make the navigation bar clear for specific view and ensure that view navigating to other views/popping modal they are returned to the default values?
P.S I tried using the onAppear method and that doesn't do anything.
Hello,
I am fetching and displaying the .fullalbums for an Artist through the MusicKit api.
The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch.
Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
Is there a way to to send notifications based on a participants activity?
Like in the Keynote, Apple included example for Music app where a participant adds songs to a shared queue and all other users get a notification about the activity.
Topic:
App & System Services
SubTopic:
General
Tags:
Group Activities
wwdc21-10183
wwdc21-10184
wwdc21-10187
Currently in iOS 15 beta 2, you can the search suggestions to complete a search term, but is there a way that when the user select a suggestion, not only does it complete the term but also performs a .onSubmit?
So that without having to hitting search on the keyboard, we can programmatically trigger a onSubmit?
Hey everyone,
I had a sample app I was working on with the first beta which had SharePlay/Group Activity working fine.
Beta 2 seems to have broken it. It doesn't trigger any activity. I even tried deleting and reinstalling the app, but that doesn't seem to fix the issue either.
Console error print:
Dropping activity as there is no active conversation
Any ideas how to fix this issue?