title: Add to iCloud Drive with UIActivityViewController
body: <p>I would like to use UIActivityViewController's "Add to iCloud Drive" action pictured here to upload a file that I store on the iOS device: </p>
  
  <p><a href="https://i.stack.imgur.com/LQpGH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LQpGH.png" alt="enter image description here"></a></p>
  
  <p>Currently in my custom UIActivityItemProvider class I have my - (id)item method returning this:
          [NSURL fileURLWithPath:fullPath]; </p>
  
  <p>FullPath is the path to the file that I am creating and want to upload to iCloud drive. It works when I click "Add to Notes", the mail activity, or my custom activity but it does not for iCloud drive. Instead of using this file, it creates a default file with the subject I am using for the email activity which is "Attached is a file." as the file contents. Here is the code I am using to present the UIActivityViewController:</p>
  
  <pre><code>CustomActivity * customActivity = [[CustomActivity alloc]init];
  CustomItemProvider *itemProvider = [[CustomItemProvider alloc] initWithPlaceholderItem:_itemsArray];
  
  NSArray *activityItems = [NSArray arrayWithObjects:itemProvider, NSLocalizedString(@"Attached is a file.", nil), nil];
  
  UIActivityViewController *avc = [[UIActivityViewController alloc]
                                   initWithActivityItems:activityItems
                                   applicationActivities:@[customActivity]];
  
  float iOSVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
  
  if (iOSVersion &lt; 9.0)
  {
      avc.excludedActivityTypes = @[UIActivityTypePostToFacebook, UIActivityTypeAirDrop, UIActivityTypeCopyToPasteboard, UIActivityTypeMessage, UIActivityTypePostToFlickr, UIActivityTypePostToTwitter, UIActivityTypePostToVimeo, UIActivityTypePostToWeibo, UIActivityTypePrint, UIActivityTypeSaveToCameraRoll, UIActivityTypePostToTencentWeibo,UIActivityTypeAssignToContact, UIActivityTypeAddToReadingList];
  }
  else
  {
      avc.excludedActivityTypes = @[UIActivityTypePostToFacebook, UIActivityTypeAirDrop, UIActivityTypeCopyToPasteboard, UIActivityTypeMessage, UIActivityTypePostToFlickr, UIActivityTypePostToTwitter, UIActivityTypePostToVimeo, UIActivityTypePostToWeibo, UIActivityTypePrint, UIActivityTypeSaveToCameraRoll, UIActivityTypePostToTencentWeibo,UIActivityTypeAssignToContact, UIActivityTypeAddToReadingList, UIActivityTypeOpenInIBooks];
  }
  
  [self presentViewController:avc animated:YES completion:nil];
  </code></pre>