Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you add an ios framework to your C# Xamarin iOS project?

In iOS, you can add frameworks when you go to "Your Project" =>"Targets" => "Build Phases" and then press the add button to add frameworks.

So, lets say I wanted to add CoreVideo framework, CoreMedia framework, and CoreGraphics.framework. How can I add these frameworks to my Xamarin iOS project?

I am new to Xamarin iOS. thanks for reading, I appreciate any comments or suggestions.

like image 370
xiaowoo Avatar asked Jul 05 '13 17:07

xiaowoo


People also ask

What is an iOS framework?

What is a Framework? Frameworks are self-contained, reusable chunks of code and resources you can import into many apps. You can even share them across iOS, tvOS, watchOS and macOS apps. When combined with Swift's access control, frameworks help define strong, testable interfaces between code modules.

How do I add a framework in Swift?

In the app, select the project from the project navigator, select the Stocktance target, and scroll to Frameworks, Libraries, and Embedded Content. Click on the plus button, click Add Other… and select Add Files… Navigate to the SettingsKit folder and select it. We've added the framework to the project.

How do I embed a framework in Xcode?

Adding an External Respository, Sub-Project and a FrameworkAdd a some kind of synchronised link to the external repository and download it. Add the . xcodeproj (Xcode project) file from the external repo as a sub-project to your own project, in Xcode's File Navigator. Add the framework to your project's build phases.


1 Answers

In most cases this is done automagically for you.

E.g. when you use a type from MonoTouch.CoreGraphics, like CGColor, then the tooling will add a reference to the CoreGraphics framework. No further action is required from you.

The only time when you need to manually specify frameworks is when you link with a native library that has dependencies on some framework(s) that your application itself might now have.

In general, when you create bindings to an Objective-C library, you add such requirements inside the [LinkWith] attribute. E.g.

[assembly: LinkWith ("libX.a", LinkTarget.Simulator, Frameworks="CoreGraphics")]

You can add several frameworks by separating them with a space.

You can also use the Additional mtouch arguments (from your Project Options) to specify options to the native linker if you do not use a binding project, e.g.

-gcc_flags="-framework CoreGraphics"
like image 60
poupou Avatar answered Sep 26 '22 17:09

poupou