Shield or Block application by application Bundle Id

I'm trying to shield or block the application by application Bundle Id.

Tried below code to shield "Phone Application"

if let phoneAppToken = Application(bundleIdentifier: "com.apple.mobilephone").token {
    print("App Token Found")
    store.shield.applications = [phoneAppToken]
} else {
    print("App Token Not Found")
}

Always i'm getting "App Token Not Found"

Also i wants to block/shield my current application.

if let phoneAppToken = Application(bundleIdentifier: "com.mobile.bundileid").token {
    print("App Token Found")
    store.shield.applications = [phoneAppToken]
} else {
    print("App Token Not Found")
}

This also failed.

Answered by Frameworks Engineer in 748678022

Application tokens are not generated when initializing applications via bundleID. The only way to generate application tokens is to use the FamilyActivityPicker with a FamilyActivitySelection object.

You can block applications via bundle ID using store.application.blockedApplications. However, apps that have authorized via FamilyControls cannot be shielded or blocked.

Accepted Answer

Application tokens are not generated when initializing applications via bundleID. The only way to generate application tokens is to use the FamilyActivityPicker with a FamilyActivitySelection object.

You can block applications via bundle ID using store.application.blockedApplications. However, apps that have authorized via FamilyControls cannot be shielded or blocked.

Using blockedApplications able to block the below applications

store.application.blockedApplications = [
    Application(bundleIdentifier: "com.apple.DocumentsApp"),
    Application(bundleIdentifier: "com.apple.mobilesafari"),
    Application(bundleIdentifier: "com.apple.Health"),
    Application(bundleIdentifier: "com.apple.Passbook")]

But still the phone app is not blocking

store.application.blockedApplications = [
    Application(bundleIdentifier: "com.apple.mobilephone")]

Referring this page to get bundle id of native iPhone application.

Also the Phone App is not being listed in FamilyActivityPicker. So we will allowed to block the Phone App via store.application.blockedApplications

Intention is to prevent child being access the phone app during the study hours, If any emergency allow them for calling to emergency numbers from my main application.

Shield or Block application by application Bundle Id
 
 
Q