Creating bindings for new Pinterest SDK

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating bindings for new Pinterest SDK

efontana
I'm attempting to use the Pinterest SDK from http://developers.pinterest.com/ios/

I'm able to open up the xcode project build and run it, it works fine for what I need.

I want to build MonoTouch bindings for it, I don't know anything about Xcode projects, however, I do see that there is a header file Pinterest.h which contains the API.  Isn't there some sort of static library (.a) or something that goes with this header?  I see pinterest.embedddedframework which contains the .h so I assume this is the "library" ?

I've been looking at monotouch-bindings to see how others have been done, after doing some research it seems that ObjectiveSharpie has been created to help this process, has this replaced the btouch tool?

Should I just follow this guide:

http://docs.xamarin.com/guides/ios/advanced_topics/binding_objective-c/binding_walkthrough

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

efontana
Well, I followed the instructions and created the bindings, most of the api works;

CanPinWithSDK  works
OpenUserWithUsername works

however, when I try to use
CreatePinWithImageUrl

it crashes, with this stack;

http://pastebin.com/eCzxxPVn

It's the only method which doesn't take strings in, it takes two NSUrls which I created with
NSUrl.FromString("http://placekitten.com/500/400") and NSUrl.FromSring("http://placekitten.com")
and a description string.

Is there something special about NSUrls?

The binding looks like this:

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

Rolf Bjarne Kvinge
Hi,

On Mon, Aug 5, 2013 at 8:25 PM, efontana <[hidden email]> wrote:

> Well, I followed the instructions and created the bindings, most of the api
> works;
>
> CanPinWithSDK  works
> OpenUserWithUsername works
>
> however, when I try to use
> CreatePinWithImageUrl
>
> it crashes, with this stack;
>
> http://pastebin.com/eCzxxPVn
>
> It's the only method which doesn't take strings in, it takes two NSUrls
> which I created with
> NSUrl.FromString("http://placekitten.com/500/400") and
> NSUrl.FromSring("http://placekitten.com")
> and a description string

According to this page: http://developers.pinterest.com/ios/ they're
not actually NSUrls, but strings.

Rolf

>
> Is there something special about NSUrls?
>
> The binding looks like this:
>
>  [Export ("createPinWithImageURL:sourceURL:description:")]
>     void CreatePinWithImageUrl(NSUrl imageURL, NSUrl sourceURL, string
> descriptionText);
>
>
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Creating-bindings-for-new-Pinterest-SDK-tp4658416p4658417.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

efontana
Well, I made the bindings with Objective Sharpie, and their working sample uses this call:

 [_pinterest createPinWithImageURL:[NSURL URLWithString:@"http://placekitten.com/500/400"]
                            sourceURL:[NSURL URLWithString:@"http://placekitten.com"]
                          description:@"Pinning from Pin It Demo"];

So I don't think their strings
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

Rolf Bjarne Kvinge
Hi,

Then I don't know what might be going wrong.

Maybe a crash report would reveal what the library's trying to do (the
best way to get a properly symbolicated crash report is to run your
app and make it crash on a device, then get the crash report from
Xcode's Organizer)

Rolf

On Tue, Aug 6, 2013 at 1:03 PM, efontana <[hidden email]> wrote:

> Well, I made the bindings with Objective Sharpie, and their working sample
> uses this call:
>
>  [_pinterest createPinWithImageURL:[NSURL
> URLWithString:@"http://placekitten.com/500/400"]
>                             sourceURL:[NSURL
> URLWithString:@"http://placekitten.com"]
>                           description:@"Pinning from Pin It Demo"];
>
> So I don't think their strings
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Creating-bindings-for-new-Pinterest-SDK-tp4658416p4658420.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

efontana
Here is the log from Xcode

http://pastebin.com/NWdy8FV9

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

efontana
In reply to this post by Rolf Bjarne Kvinge
Also, here is the generated code for the method:

[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);
                       
                }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating bindings for new Pinterest SDK

Rolf Bjarne Kvinge
Hi,

This all looks correct.

Maybe there's something else you need to setup/configure/initialize
before you can call CreatePinWithImageUrl?

Rolf

On Tue, Aug 6, 2013 at 8:02 PM, efontana <[hidden email]> wrote:

> Also, here is the generated code for the method:
>
> [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);
>
>                 }
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Creating-bindings-for-new-Pinterest-SDK-tp4658416p4658423.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Loading...