Pinterest SDK for Monotouch - CreatePinWithImageURL failed

I am trying to create bindings for the Pinterest SDK:

http://developers.pinterest.com/ios/

Most of the APIs work; CanPinWithSDKreturns correctly true/ falseas expected.

But CreatePinWithImageURLalways fail. The top of the stack is as follows:

Feb  3 17:28:45 UK-IT-IPD-D0004 PinterestSDKDemo[8992] <Error>: Stacktrace:
Feb  3 17:28:45 UK-IT-IPD-D0004 PinterestSDKDemo[8992] <Error>:   at <unknown> <0xffffffff>
Feb  3 17:28:45 UK-IT-IPD-D0004 PinterestSDKDemo[8992] <Error>:   at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_IntPtr (intptr,intptr,intptr,intptr,intptr) <0xffffffff>
Feb  3 17:28:45 UK-IT-IPD-D0004 PinterestSDKDemo[8992] <Error>:   at PinterestSDK.Pinterest.CreatePinWithImageURL (MonoTouch.Foundation.NSUrl,MonoTouch.Foundation.NSUrl,string) [0x0005f] in /Users/Alasdair/code/PinterestSDKBinding/PinterestSDKBinding/obj/Debug/ios/PinterestSDK/Pinterest.g.cs:154

The binding is as follows:

[Export ("createPinWithImageURL:sourceURL:description:")]
void CreatePinWithImageURL (NSUrl imageURL, NSUrl sourceURL, string descriptionText);

The generated code is as follows:

[Export ("createPinWithImageURL:sourceURL:description:")]
[CompilerGenerated]
public virtual void CreatePinWithImageURL (NSUrl imageURL, NSUrl sourceURL, string descriptionText)
{
    if (imageURL == null)
        throw new ArgumentNullException ("imageURL");
    if (sourceURL == null)
        throw new ArgumentNullException ("sourceURL");
    if (descriptionText == null)
        throw new ArgumentNullException ("descriptionText");
    var nsdescriptionText = NSString.CreateNative (descriptionText);

    if (IsDirectBinding) {
        MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_IntPtr (this.Handle, selCreatePinWithImageURLSourceURLDescription_Handle, imageURL.Handle, sourceURL.Handle, nsdescriptionText);
    } else {
        MonoTouch.ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr_IntPtr_IntPtr (this.SuperHandle, selCreatePinWithImageURLSourceURLDescription_Handle, imageURL.Handle, sourceURL.Handle, nsdescriptionText);
    }
    NSString.ReleaseNative (nsdescriptionText);

}

My application code is as follows:

Pinterest pinterest = new Pinterest ("1234", "prod");
NSUrl imageUrl = new NSUrl(@"http://static.bbci.co.uk/frameworks/barlesque/2.59.12/orb/4/img/bbc-blocks-dark.png");
NSUrl sourceUrl = new NSUrl(@"http://www.bbc.co.uk");
pinterest.CreatePinWithImageURL (imageUrl, sourceUrl, "description");

It crashes without any exceptions as soon as it clicks void_objc_msgSend_IntPtr_IntPtr_IntPtr

I set the client ID in my info.plist(copied from my demo application that works fine in the C object).

Any ideas? Has anyone successfully created bindings for this SDK?

+3
source
1

, PInterest , :

Pinterest pinterest = new Pinterest ("1234", "prod");

, , PInterest NSString (System.String ), retain . API ( ), ( ).

- ObjC ( NSObject, / ). ObjC, , , NSString (, ) .

:

  • API initWithClientId:urlSchemeSuffix:, NSString ( string);

  • keep the instance NSStringfor "1234"and "prod"live (e.g. static fields) if your instance is needed pinterest.

+2
source

All Articles