skip to Main Content

First of all, please understand that I use a translator.

I’m using the UIAActivityViewController to create a feature that shares images and texts.

When I run the sharing function, I get a message like below from the console.

Does anyone know why?
Please tell me the answer.

This is console message:

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

I don’t think the message in the picture should come out.
This is my code.

 guard let image = postImageView.image else { return }
 let items = [viewModel.post.caption, image] as [Any]
 let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
 ac.popoverPresentationController?.sourceView = self.view
 ac.excludedActivityTypes = [.assignToContact, .copyToPasteboard]
 present(ac, animated: true)

2

Answers


  1. Your code for presenting the UIActivityViewController looks correct. However, if there’s an issue, it might be related to the content you’re trying to share or the context in which you’re calling this code.

    You’re unwrapping postImageView.image with guard let image = postImageView.image else { return }. Make sure that postImageView.image is not nil. If it’s nil, the UIActivityViewController might encounter issues when trying to share it.

    Also may be problem that you are running not on the device

    By moving the code to viewDidAppear, you ensure that your view controller is in the view hierarchy before presenting the UIActivityViewController. This should resolve the warning message you’re encountering.

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    
        guard let image = postImageView.image else { return }
        let items = [viewModel.post.caption, image] as [Any]
        
        let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
        ac.excludedActivityTypes = [.assignToContact, .copyToPasteboard]
    
        // Present the UIActivityViewController
        present(ac, animated: true)
    }
    
    Login or Signup to reply.
  2. I present like this, still works on tablets/phones, devices/simulators:

    extension UIViewController {
        /// Present over a given view controller
        func present(over viewController: UIViewController?) {
            guard let viewController = viewController else { return }
            if let popoverController = self.popoverPresentationController {
                popoverController.sourceView = viewController.view
                popoverController.permittedArrowDirections = []
                popoverController.sourceRect = CGRect(x: viewController.view.bounds.midX, y: viewController.view.bounds.midY, width: 0, height: 0)
            }
            viewController.present(self, animated: true)
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search