Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] Share plugin shows warning of future failure when used in IOS

Open danlfarnell opened this issue 4 years ago • 2 comments

Description

When using the share plugin to share a file the following warning is logged to the debug console which warns that the request will fail in the future.

2021-11-15 16:14:54.142159-0500 testing123.iOS[5427:673207] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement +_allowedItemPayloadClasses. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error. Extension: <EXConcreteExtension: 0x600000e7f3c0> {id = com.apple.reminders.sharingextension} Items: ( "<NSExtensionItem: 0x60000394f6b0> - userInfo: {\n NSExtensionItemAttachmentsKey = (\n "<NSItemProvider: 0x60000103d810> {types = (\n \"public.plain-text\",\n \"public.file-url\"\n)}"\n );\n "com.apple.UIKit.NSExtensionItemUserInfoIsContentManagedKey" = 0;\n}" )

Steps to Reproduce

  1. Create a new app with one button that launches the Share window using the following code.

  2.     var fileName = "testFile.txt";
         File.WriteAllText("Testing", fileName);
    
         await Share.RequestAsync(new ShareFileRequest()
         {
             Title = $"Report",
             File = new ShareFile(fileName),
         });
    
  3. The warning will be logged to console.

Expected Behavior

It works as expected but there is concern that it will fail in the future.

Actual Behavior

It works as expected but there is concern that it will fail in the future.

Basic Information

  • Version with issue: 1.7.0

  • Last known good version: Unsure. It exists in 1.6.1 as well however.

  • IDE:

  • Platform Target Frameworks:

    • iOS: 15
  • Nuget Packages:

  • Affected Devices:

Screenshots

Reproduction Link

danlfarnell avatar Nov 15 '21 21:11 danlfarnell

The following has also been set in info.plist as per instructions from https://docs.microsoft.com/en-us/xamarin/essentials/share?context=xamarin%2Fxamarin-forms&tabs=ios

NSPhotoLibraryAddUsageDescription This app needs access to the photo gallery for saving photos and videos. NSPhotoLibraryUsageDescription This app needs access to photos gallery for saving photos and videos.

danlfarnell avatar Nov 15 '21 21:11 danlfarnell

you should add an extension file and use UIActivityViewController extension ARResultController { func presentShareSheet(for url: URL) { let objectsToShare: [Any] = [url] let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil) activityVC.popoverPresentationController?.sourceView = view present(activityVC, animated: true, completion: nil) } }

frank-1992 avatar Jul 27 '22 08:07 frank-1992