UICloudSharingController doesn't send mail

Hi,


We've adding sharing capabilities to our CloudKit iOS app and have managed to get the sharing to work through text, links, facebook etc.


However, when we try to send the share through mail, nothering happens. The UICloudSharing controller shows, but when we click the Mail icon under "Choose how you'd like to send your invitation:", the UICloudSharingController is dimissed, but nothing more happens. No error message, nothing.


Does someone know what could be this issue here?


Thanks a lot in advance!


let cloudSharingController: UICloudSharingController = UICloudSharingController(share: share, container: AppDelegate.currentAppDelegate().cloudKitController!.container)
cloudSharingController.delegate = self
                   
cloudSharingController.availablePermissions = [
UICloudSharingPermissionOptions.allowPrivate,
UICloudSharingPermissionOptions.allowReadWrite
]
                   
self.present(cloudSharingController, animated: true, completion: nil)

Replies

I have the same problem.


1) If I pre-create the share and use initWithShare:container:, clicking Mail has the same behaviour as you

2) If I already have participants, and click Add People, clicking Mail has the same behaviour as you

3) If I have no share yet, and use the -[UICloudSharingController initWithPreparationHandler:] initialiser, constructing the share in the preparation handler, then clicking Mail DOES work. But only that time. Obviously once I have participants and a share, I need to use initWithShare:container:

The CloudShares Apple example code does not have this problem, so it's presumably something we're both doing wrong. But that will give us example code to work to.

Finally had time to look at this.


Firstly, from the docs:

itemTitle(for:) is called only when creating a new share. For an existing share, the title is retrieved from the share using the CKShareTitleKey key, which is set when a new share is saved


When you create a share, you can set the title with share[CKShareTitleKey] = @"MyTitle";


If you leave the title unset, then the Mail controller will fail to display for an existing share!!!

Thank you so much !!!

I had the same behaviour after the user Stop Sharing. I tried to delete the share in the UICloudSharingControllerDelegate method:


cloudSharingControllerDidStopSharing(_ csc: UICloudSharingController){
     // Delete the share here
}

this because when the user wants to share the record again, the UICloudSharingController will create the new share in the preparation handler. Nothing.

Anyway, if the share still exists after stop sharing, when I select another item into the items list (i.e. WhatsApp or Twitter), the UICloudSharingController open a second controller where I can add the participants from my address book BEFORE launching the selected app. At this moment, I just add one contact of mine and proceed. When the selected app will open the controller to share the url, there is no link to send. All right. Cancel.

Now, if I try to share the record with the same UICloudSharingController, it shows me the contact I've just added: select it and tap on Remove Access. Ta dan!

Retry to share the record again, select the Mail app among the items list of the UICloudSharingController and then will work.


I think it is an issue with the UICloudSharingController.

_/\_