containerURLForSecurityApplicationGroupIdentifier returns nil on iOS Simulator

前端 未结 7 1370
我寻月下人不归
我寻月下人不归 2020-12-18 18:27

Context

With iOS8 and extensions Apple introduced the App group containers (more info here).

Problem

We use it through NSFileManager\'s

7条回答
  •  旧巷少年郎
    2020-12-18 19:04

    I find containerURLForSecurityApplicationGroupIdentifier can do work both on real device and simulator with xcode 6.2. I came across into this thread because i also got nil, but now i find the root cause is my typing error of the 'App Groups' name.

    More, here is the list you need check:

    1. make sure 'app groups' been created either by xcode or web console at https://developer.apple.com
    2. make sure the 'app groups' is 'enabled' on 'Development' and 'Production' at 'web console: Identifiers->App IDs'
    3. make sure the matched 'Provisioning Profiles' are 'active'
    4. the groups name of entitlement in both containing app and extension app should match the one you created in step 1
    5. make sure the bundle identifier of all targets is the same as the one from 'web console: Identifiers->App IDs
    6. make sure the 'Team' inside of all targets matches the one from web console
    7. make sure to pick the correct group under 'Capabilities' tab on both containing app and extension app target, and no red color
    8. clean up xcode cache by cmd+shift+k
    9. rebuild and pray

提交回复
热议问题