Return nil when looking up the path for the App Group

I have enabled the application group and created a group called "group.com.classData" enter image description here

And my code looks like this:

let plistPath3 = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.classData")
print(plistPath3) //returns "nil"

      

And it returns zero. Why is this happening?

+3


source to share


1 answer


I ran into this error while developing a share extension. It turned out that although I added the application group right to the application target, I hadn't added it to the extension target. I needed to select an extension from the project / target dropdown:

A screenshot of Xcode that shows the location of the dropdown list with the projects and targets.



Then I clicked on the Features tab and enabled Application Groups. The application group I created for the application was already listed; I just needed to check its checkbox. When I ran the application again, it containerURL(forSecurityApplicationGroupIdentifier:)

returned nonzero.

0


source







All Articles