The application is not permitted to access iTunes Store accounts with UIActivityViewController

Viewed 201

I am trying to share my app URL with UIActivityViewController and here is my code:

let items = [URL(string: "https://itunes.apple.com/de/app/idxxxxxxxxx")!]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
present(ac, animated: true)

App URL is working fine on browser. But crashing on iPhone.

Here is the log I am getting in console:

ACAccountStore: [66A6F31E] Failed to save an account. account = | error = Error Domain=com.apple.accounts Code=7 "The application is not permitted to access iTunes Store accounts" UserInfo={NSLocalizedDescription=The application is not permitted to access iTunes Store accounts}

[accounts] ACAccountStore: Failed to create the local account. error = Error Domain=com.apple.accounts Code=7 "The application is not permitted to access iTunes Store accounts" UserInfo={NSLocalizedDescription=The application is not permitted to access iTunes Store accounts}

1 Answers

I was getting the same errors, casting it to any and adding a title solved mine. Check the code for more clarification

let item: [Any]  = ["This app is my favorite",URL(string: "https://itunes.apple.com/de/app/idxxxxxxxxx")!]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
present(ac, animated: true)
Related