Monotouch binding for TouchJSON?

后端 未结 3 890
小蘑菇
小蘑菇 2020-12-21 21:22

The admob sdk for iPhone uses a proprietary libAdMobNoThumb.a library and an Objective-C source based TouchJSON library.

Does anybody know of a C# bindi

相关标签:
3条回答
  • 2020-12-21 21:28

    Eric,

    Sorry for the delay, but lately I have been very busy with pure xcode projects. Let me tell you how I created a TouchJSON library.

    I created a library project with xcode, and copied the TouchJSON sources that came with the latest admob library. I built two nothumb release versions, one for the simulator, and one for the device. That produces two libraries. To facilitate using these in MT projects, I used the lipo tool to combine them into a fat library. Fat libraries are convenient as they can be used in simulator as well as device builds. The complete project, including the fat libary libTouchJSON.a and the script that was used to build the fat lady, are present in the zip file available at http://www.filedropper.com/touchjson.

    (Note: this is posted as an answer to my initial question, as it was slightly too long to be accepted as a comment on the question by Eric S)

    0 讨论(0)
  • 2020-12-21 21:32

    Your AdMob library cannot find the CJSONDeserializer or CJSONSerializer classes, which I presume come from libTouchJSON.a. Generally this means that your libTouchJSON.a wasn't included in your project. You should double check all your extra arguments, and ensure that your libTouchJSON is not thumb and includes all the architectures you're trying to link (x86 for simulator, armv6 for device)

    0 讨论(0)
  • 2020-12-21 21:36

    Since many people will find this question, you can use the up to date monotouch bindings for admob posted on github here https://github.com/dalexsoto/AlexTouch.GoogleAdMobAds

    Here is an example of how to use it and how to suscribe to its events

    public override void ViewDidLoad ()
            {
                base.ViewDidLoad ();
    
                var ad = new GADBannerView(new RectangleF(new PointF(0,0), GADBannerView.GAD_SIZE_300x250))
                {
                    AdUnitID = "Use Your AdMob Id here",
                    RootViewController = this
    
                };
    
                ad.DidReceiveAd += delegate 
                {
                    this.View.AddSubview(ad);
                    Console.WriteLine("AD Received");
                };
    
                ad.DidFailToReceiveAdWithError += delegate(object sender, GADBannerViewDidFailWithErrorEventArgs e) {
                    Console.WriteLine(e.Error);
                };
    
                ad.WillPresentScreen += delegate {
                    Console.WriteLine("showing new screen");
                };
    
                ad.WillLeaveApplication += delegate {
                    Console.WriteLine("I will leave application");
                };
    
                ad.WillDismissScreen += delegate {
                    Console.WriteLine("Dismissing opened screen");
                };
    
                Console.Write("Requesting Ad");
                ad.LoadRequest(new GADRequest());
    }
    
    0 讨论(0)
提交回复
热议问题