Couldn't read values in CFPrefsPlistSource when presenting UIActivityViewController

When I try to display a UIActivityViewController, I get funky logging in the xcode console.

This is my code:

@IBAction func shareAction(_ sender: Any) {
        // text to share
        let text = "Some very interesting text!"
        let url = Constants.URL.appStore.absoluteString
        guard let logo = UIImage(named: "App Logo")?
            .circle()            
            .resize(333, 333) else { return }
        
        // set up activity view controller
        let itemsToShare: [Any] = [ logo, text, url ]
        
        let activityViewController = UIActivityViewController(activityItems: itemsToShare, applicationActivities: nil)
        activityViewController.popoverPresentationController?.sourceView = self.view
        
        // exclude some activity types from the list
        if #available(iOS 15.4, *) {
            activityViewController.excludedActivityTypes = [ .airDrop, .sharePlay ]
        } else {
            activityViewController.excludedActivityTypes = [ .airDrop ]
        }
        
        // present the Share Sheet
        self.present(activityViewController, animated: true, completion: nil)
    }

The logging emerges in the console as soon as the code calls:

        self.present(activityViewController, animated: true, completion: nil)

When I set a break point on that line, no logging occurs. If I add a completion block to that call with a break point on the first line, the logging occurs before it hits that break point. so all logging seems to be generated while displaying the UIActivityViewController.

This is my logging

Cannot issue sandbox extension for URL:https://apps.apple.com/app/id<my app id>

Couldn't read values in CFPrefsPlistSource<0x303b38900> (Domain: com.apple.country.carrier_1, User: kCFPreferencesCurrentUser, ByHost: No, Container: /var/mobile/Library/CountryBundles/, Contents Need Refresh: No): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)}>

(501) personaAttributesForPersonaType for type:0 failed with error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction.}

Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}

elapsedCPUTimeForFrontBoard couldn't generate a task port

Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}

elapsedCPUTimeForFrontBoard couldn't generate a task port

Received port for identifier response: <(null)> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port

<0x10640ca30> Gesture: System gesture gate timed out.

Line 2, 5, 7, 9 are red the other lines are yellah

I have been looking on the internet and found nothing.

I have been looking in this forum, and found one possible match (without a solution): https://forums.developer.apple.com/forums/thread/746721

When looking through the logging: 'entitlement com.apple.runningboard.primitiveattribute' Should I add something to my entitlements to be allowed to show a UIActivityViewController?

Is that the solution? If so: How do I add that entitlement? (or any of the other entitlements mentioned there) And since when is that required??

The app (and this feature) seem to work like a charm ... so I could ignore. Only I find it difficult to ignore RED logging by xcode. If it is red, it is bound to be kinda serious, right?

Or is there a whole other reason / cause why I suddenly get this?

Now running:

  • xcode Version 15.3 (15E204a)
  • iOS 17.4.1

Couldn't read values in CFPrefsPlistSource<0x3028e8f30> (Domain: com.apple.country.carrier_1, User: kCFPreferencesCurrentUser, ByHost: No, Container: /var/mobile/Library/CountryBundles/, Contents Need Refresh: No): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

have the same probrem. Did you found any solution?

Couldn't read values in CFPrefsPlistSource when presenting UIActivityViewController
 
 
Q