Click here to Skip to main content
14,452,891 members

Xamarin C# Binding of a Cocoapods iOS SDK using Sharpie

Rate this:
5.00 (1 vote)
Please Sign up or sign in to vote.
5.00 (1 vote)
4 Jul 2016CPOL
In this blog post, let's see how to generate Xamarin C# binding of IBM MobileFirst Foundation iOS Cocoapods SDK using Objective Sharpie.

Post my endeavour with Xamarin.Android Bindings and Xamarin Apps with IBM MobileFirst, I received an interesting requirement from my colleague Chethan. He wants Xamarin C# binding of our IBM MobileFirst Foundation Objective-C APIs. I thought this is an opportunity to try something new and accepted the challenge.

I immediately started exploring to find something called Objective Sharpie on Xamarin’s Objective-C binding page. While reading through the documentation, I found one more interesting scenario which will simplify my binding effort, i.e., Effective version 3.0, Objective Sharpie supports binding CocoaPods.

Yay!! We already have IBM MobileFirst Platform Foundation iOS SDK available on Cocoapods and now it’s time to follow the steps mentioned in the documentation.

The first step is to download, setup and update objective Sharpie. Once we are all good, our journey begins  towards achieving Xamarin C# binding.

Run the below command on a terminal.

$ sharpie pod init ios IBMMobileFirstPlatformFoundation

If all goes well, here’s the expected output:

Setup completed

** Searching for requested CocoaPods ...

** Working directory:

**   - Writing Podfile ...

**   - Installing CocoaPods ...

**     (running `pod install --no-repo-update`)

Analyzing dependencies

Downloading dependencies

Installing IBMMobileFirstPlatformFoundation (8.0.2016061012)

Generating Pods project

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 1 total pod


** ??  Success! You can now use other `sharpie pod` commands.

Success! There’s one more command before we see the binding,

$ sharpie pod bind

Possible Errors & Their Fix

Commands can go good and at the same time can error-out. In my case, there were a bunch of errors.

xcodebuild[56779:791166] [MT] PluginLoading: 
Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 
for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' 
not present in DVTPlugInCompatibilityUUIDs

xcodebuild[56779:791166] Failed to load plugin at: 
/Users/VMac/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin, skipping.  
Reason for failure: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: 
attempt to insert nil object from objects[0]

User defaults from command line:

IDEDerivedDataPathOverride = /Users/VMac/Pods/sharpie-build

=== BUILD TARGET Pods-ObjectiveSharpieIntegration OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies

Code Sign error: No code signing identities found: No valid signing identities 
(i.e. certificate and private key pair) were found.


The following build commands failed:

Check dependencies

(1 failure)

error: xcodebuild did not run successfully (exit code: 65)

No worries! We can fix the error in multiple ways:

  1. As the issue is with unity plugin, we can uninstall unity from the Mac and install again. If that doesn’t fix the error,
  2. Navigate to ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ folder and delete the plugin if the plugin is not in use.

There’s also a chance that the Cocoapods iOS SDK expects a lower iPhoneOS SDK like the error below:


Submitting usage data to Xamarin...

Submitted - thank you for helping to improve Objective Sharpie!

Done. Exiting with error code 1.

error:  framework requires SDK 'iphoneos9.2' which is not installed. You may need a newer Xcode.

In reality, we may see SDK version higher than the one mentioned in the error description and our Xcode is up to date. To fix the error:

  • Download the version of Xcode with the SDK version you are looking for.
  • Right click on the Xcode_ .dmg file and select “Show Package Contents” from the menu.
  • Now navigate to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ and copy iPhoneOS<Version_number>.SDK folder.
  • Paste the copied folder to

If all goes well, you should see a lengthy output on the terminal + a couple of warnings with a word Done. You should see the below binding files once you navigate to the base folder.

Binding output

Note: You can follow the above steps to generate Xamarin C# binding for any Cocoapods iOS SDK.

If you see any errors, post the same as a comment below.

The post Xamarin C# binding of a Cocoapods iOS SDK using Sharpie appeared first on Vidyasagar MSC.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Comments and Discussions

-- There are no messages in this forum --
Technical Blog
Posted 4 Jul 2016

Tagged as


1 bookmarked