title: Xamarin-ios share & receive audio file
body: <p>How can I share a audio file from my app to other apps and receive audio files from other apps?</p>
  
  <p>I would like a functionality like this:
  <a href="https://i.stack.imgur.com/vAmiU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vAmiU.png" alt="img"></a></p>
  
  <p>I am unable to attach a audio file. Here is the code snippet:</p>
  
  <pre><code>var fileData = NSUrl.FromFilename(path);  
  var item = UIActivity.FromObject(@"&lt;html&gt;&lt;body&gt;&lt;b&gt;URL&lt;/b&gt;: &lt;a href='" + url + "'&gt;" + url + "&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;");// NSObject.FromObject(uiImage);
  var activityItems = new[] { fileData };
  NSString message = (NSString)"Test";
  var activityController = new UIActivityViewController(activityItems, null);
  activityController.SetValueForKey(NSObject.FromObject("The subject value"), new NSString("subject"));
  var topController = UIApplication.SharedApplication.KeyWindow.RootViewController;
  while (topController.PresentedViewController != null)
  {
      topController = topController.PresentedViewController;
  }
  topController.PresentViewController(activityController, true, () =&gt; { });
  </code></pre>
  
  <p>I would also like to add subject and body if file attached as mail.</p>
  
  <p>tried this but no luck, getting an error.:</p>
  
  <pre><code>activityController.SetValueForKey(NSObject.FromObject("The subject value"), new NSString("subject"));
  activityController.SetValueForKey(NSObject.FromObject("The body value"), new NSString("body"));
  </code></pre>
  
  <p>Also I would like to receive audio files shared by other apps. I have done the feature in android using dependency services and intent filters. For android the code is been added to mainactivity.cs where I use intent filters to accept audio files from other app. How to do that in iOS?</p>