Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot get groups folder on iOS 11 simulators

The following always returns nil on all iPhone 11 simulators but works fine on devices and simulators prior to 11.

let containerURL = fileManager.containerURL(forSecurityApplicationGroupIdentifier: "group.my.group.name.here")

Anyone else encounter this? What is the solution?

like image 995
Bret Avatar asked Oct 29 '22 02:10

Bret


1 Answers

After a whole day of debugging, I think I might have found a workaround.

I think it has to do with the Bundle Identifier. So if you have a bundle identifier xx, it fails, but it works if your bundle identifier is xx.xx

So for example it fails with Bundle Identifier: musicapp

It will work with the Bundle Identifier: com.steventso.musicapp or even com.musicapp

Since you can't change the Bundle Identifier after you've released the app to the public, the workaround is to create a new Target that you use strictly for development and when using the simulator where it is under a bundle identifier with the naming scheme xx.xx

Yeah it's a strange bug I hope they fix, but I think I was wrong in even naming it with the scheme of xx in the first place.

It's hard to tell if this will break iPhone X since there is no physical device to test on, so fingers cross this works out okay.

like image 123
StevenTsooo Avatar answered Nov 13 '22 00:11

StevenTsooo