UIActivityViewController and presentActivityController generating numerous errors

Hello,

I recently came encountered an error with UIActivityViewController in objective-c that used to work. In fact, I copied the below code form one app (where it worked) to another (where it stopped working) generating a number of errors below. On a physical device, the activity controller (for airdrop and others) pops up and then immediately pops down when these errors appear with no chance to interact. There are no issues on the Xcode Simulator and it works fine. Any suggestions would be appreciated.

-- Objective-C Code --

    // create a message

    NSString *theMessage = @"Some text we're sharing with an activity controller";

    NSArray *items = @[theMessage];

    // build an activity view controller

    UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:items applicationActivities:nil];

    // and present it

    [self presentActivityController:controller];

--- Error Log ---

2022-04-18 22:11:54.446396-0400 myTestApp[5221:696645] shareText the dog went to the zoo 2022-04-18 22:11:56.087701-0400 myTestApp[5221:696645] [Default] Task myTestApp[5221]/1#4 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil 2022-04-18 22:11:57.842069-0400 myTestApp[5221:696645] [Default] Task myTestApp[5221]/1#4 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil 2022-04-18 22:11:59.524509-0400 myTestApp[5221:696645] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2022-04-18 22:11:59.525014-0400 myTestApp[5221:696645] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2022-04-18 22:11:59.525118-0400 myTestApp[5221:696645] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2022-04-18 22:11:59.561512-0400 myTestApp[5221:696645] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.) 2022-04-18 22:11:59.572331-0400 myTestApp[5221:696645] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x15746a580; baseClass = UICollectionReusableView; frame = (20 288; 374 52); layer = <CALayer: 0x281921340>> 2022-04-18 22:11:59.589231-0400 myTestApp[5221:696645] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 2022-04-18 22:11:59.589322-0400 myTestApp[5221:696645] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.

I cannot find any reference to CopresenceCore.

Is it a class or library of yours or a third party ?

I cannot find any reference to CopresenceCore. Is it a class or library of yours or a third party ?

It's not one of mine. According to this document: https://mroi.github.io/apple-internals/, it is an internal API:

Group Activities: SharePlay; sharing of media content and programmatic state over FaceTime calls; GroupActivities.framework, CopresenceCore.framework; launchd service: com.apple.telephonyutilities.callservicesd

Thank you

Logs reformatted for readability

2022-04-18 22:11:54.446396-0400 myTestApp[5221:696645] shareText the dog went to the zoo 
2022-04-18 22:11:56.087701-0400 myTestApp[5221:696645] [Default] Task myTestApp[5221]/1#4 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil 
2022-04-18 22:11:57.842069-0400 myTestApp[5221:696645] [Default] Task myTestApp[5221]/1#4 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil 
2022-04-18 22:11:59.524509-0400 myTestApp[5221:696645] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 
2022-04-18 22:11:59.525014-0400 myTestApp[5221:696645] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 
2022-04-18 22:11:59.525118-0400 myTestApp[5221:696645] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 
2022-04-18 22:11:59.561512-0400 myTestApp[5221:696645] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.) 
2022-04-18 22:11:59.572331-0400 myTestApp[5221:696645] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x15746a580; baseClass = UICollectionReusableView; frame = (20 288; 374 52); layer = <CALayer: 0x281921340>> 
2022-04-18 22:11:59.589231-0400 myTestApp[5221:696645] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]} 
2022-04-18 22:11:59.589322-0400 myTestApp[5221:696645] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.

Nothing in the logs explains why the presentation was dismissed, but something is dismissing the presentation.

Set a symbolic breakpoint on -[UIViewController dismissViewControllerWithTransition:completion:] and look at the backtrace; it may give you a clue about who is calling for the dismissal of the presentation.

I will re-post this to make it more clear

UIActivityViewController and presentActivityController generating numerous errors
 
 
Q