0

The Apple Extension guidance has this document on Using an embedded framework to share code

I want to share code between my Extension, and the hosting application. How do I implement the following within an Xamarin app:

  • Require Only App-Extension-Safe API
  • You must choose “Frameworks” as the destination for your embedded framework in the Copy Files build phase.
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
  • first hit on Google: https://developer.xamarin.com/guides/ios/advanced_topics/embedded_frameworks/ – Jason Sep 16 '16 at 20:51

1 Answers1

0

Require Only App-Extension-Safe API

Currently there is nothing in the code review/analysis or compile phase within Xamarin.iOS that will warn or prevent APIs that are not allowed within Extensions,

i.e. There are TODO notes within the healthkit.cs:

// FIXME NS_EXTENSION_UNAVAILABLE("Not available to extensions") ;

It currently is up to the C# developer to follow Apple's Guidelines. Obviously the following would cause an app to be rejected if this was within Extension code:

var a = UIKit.UIApplication.SharedApplication;

But the Some APIs Are Unavailable to App Extensions list provided by Apple is fairly concise on what is not allowed:

Personally For code sharing purposes I add a compiler directive to my Extension projects to conditional compile code that I need to remove... ("NS_EXTENSION_UNAVAILABLE_IOS", just like what is available in ObjC/Swift Extension projects)

SushiHangover
  • 73,120
  • 10
  • 106
  • 165