ShareLink not reliable, entitlement errors

I am using public struct ShareLink<Data, PreviewImage, PreviewIcon, Label> : View where Data : RandomAccessCollection, PreviewImage : Transferable, PreviewIcon : Transferable, Label : View, Data.Element : Transferable {}

And it is generating entitlement errors and not working reliably ( will transfer 1-3 items, but not 4+ ; will not work a second time)

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

Code is

import SwiftUI

var images = Array<Image?>(repeating: nil , count: 200);

struct ShareTestGContentView: View { let columns = [GridItem(.fixed(165)), GridItem(.fixed(165))] private let twoColumnGrid = [ GridItem(.flexible(minimum: 40), spacing: 2), GridItem(.flexible(minimum: 40), spacing: 2) ] @State var selected = Set<Int>()

var body: some View {
    topSection()
    ScrollView {
        LazyVGrid(columns: twoColumnGrid, spacing: 2) { // columns: [GridItem(.flexible())]) {
            ForEach(1...100, id: \.self) { idx in
                var cr = ( selected.contains(idx) ? 16.0 : 0 )
                var lw = ( selected.contains(idx) ? 8.0 : 0 )
                VStack{
                    Button(action: {
                        if selected.contains(idx) {
                            selected.remove(idx); cr = 0.0; lw = 0.0
                        } else {
                            selected.insert(idx); cr = 16.0; lw = 8.0
                        }
                    } , label: {
                        AsyncImage(url :URL(string: "https://picsum.photos/800/800?\(idx)")) { image in
                            let _ = ( images[idx] = image.image )
                            image.image
                        }.frame(width: boxHalf,height:boxHalf).drawingGroup()
                    })
                }.overlay(
                    RoundedRectangle(cornerRadius: cr).stroke(Color.yellow, lineWidth: lw)
                ).drawingGroup()
            }
        }
    }
}
func topSection() -> some View {
    let imgarray = selected.compactMap { images[$0] }
    return HStack {
        ShareLink("",items: imgarray) { img in
            SharePreview("images", image: Image(systemName: "captions.bubble.fill"))
        }

    }
}

}

#Preview { ShareTestGContentView() }

Getting a similar error when using ShareLink in the navbar. Upon clicking the link the share tab will appear and disappear and the error will be logged in the console. This behavior loops continually.

Usage:

    NavigationStack {
            WebViewWithSpinner(urlStr: link)
            .toolbar {
                ShareLink(item: URL(string: link)!)
            }
    }

Error:

Received port for identifier response: <> 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

Hi

I was getting a crash and similar error for ShareLinks (and also a font browser). This only happened, however, when I was running the app via Xcode on a connected iPad. When running it unattached to Xcode (i.e. stopping the app in Xcode; manually launching the app on the iPad), there were no crashes and the app operated normally.

I'm not sure if this is directly related to the above, but I'm just throwing this out there in case it's helpful in troubleshooting.

Cheers

Xcode Version 15.0.1 (15A507); iPadOS 17.2

Also happening to me still in ios 17.1.2

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 had a Sharelink as a ToolbarItem. Tapping wouldn't work. I managed to solve the issue.

The presenting View was in fact a .fullscreenCover. Changing the presenting View to a view from a NavigationStack (called by a NavigationLink) did the trick for me.

I'm Facing a similar issue:

ShareLink(item: viewModel.file.localURL!) {
    Image(systemName: "square.and.arrow.up")
        .environment(\.symbolVariants, .none)
}

and I'm getting:

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

On iOS 17.4 even though I get these errors the file contained in the URL is actually shared with the application. On ios 16.4 the receiver app raises: The file "<NAME>" couldn't be opened because you don't have permission to view it.

Same with iOS 17.0

ShareLink not reliable, entitlement errors
 
 
Q