1

iPhone 的 admob sdk 使用专有libAdMobNoThumb.a库和基于 Objective-C 源的 TouchJSON 库。

有人知道 TouchJSON 的 C# 绑定,以便我们可以包含它吗?

或者有人知道如何构建一个可以包含的库吗?

我们使用 Xcode 创建了一个 iPhone 库项目并添加了完整的 TouchJSON 源代码树。我们已经将生成libTouchJSON.a的测试 iPhone 应用程序与以下 gcc_flags 链接起来:

-v -v -v -gcc_flags "-L${ProjectDir}/Lib -lAdMobNoThumb -lTouchJSON -force_load ${ProjectDir}/Lib/libAdMobNoThumb.a -force_load ${ProjectDir}/Lib/libTouchJSON.a"

这产生了以下错误输出(感谢 -v -v -v):

Error 1: mtouch failed with the following message:
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m: In function 'monotouch_debug_connect':
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1779: warning: implicit declaration of function 'select'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m: In function 'main':
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1821: warning: implicit declaration of function 'chdir'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1838: warning: implicit declaration of function 'monotouch_enable_debug_tracking'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1914: warning: implicit declaration of function 'dup2'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1921: warning: implicit declaration of function 'mini_get_debug_options'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:1925: warning: implicit declaration of function 'mono_debugger_agent_parse_options'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:2052: warning: implicit declaration of function 'getpagesize'
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:2055: warning: cast from pointer to integer of different size
/var/folders/hF/hF42FIdhEUmY1y-pGRsu1k+++TI/-Tmp-/tmpe374af5.tmp/main.m:2055: warning: initialization makes pointer from integer without a cast
Undefined symbols:
  "_OBJC_CLASS_$_CJSONSerializer", referenced from:
      objc-class-ref-to-CJSONSerializer in libAdMobNoThumb.a(AdMobAd.o)
      objc-class-ref-to-CJSONSerializer in libAdMobNoThumb.a(AdMobWebView.o)
      objc-class-ref-to-CJSONSerializer in libAdMobNoThumb.a(AdMobFlexWebView.o)
  "_OBJC_CLASS_$_CJSONDeserializer", referenced from:
      objc-class-ref-to-CJSONDeserializer in libAdMobNoThumb.a(AdMobOpener.o)
      objc-class-ref-to-CJSONDeserializer in libAdMobNoThumb.a(AdMobSearchViewController.o)
      objc-class-ref-to-CJSONDeserializer in libAdMobNoThumb.a(AdMobAd.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
 (1) (AdMobber)

有什么建议可以解决这个问题吗?

TIA,莫利克。

4

3 回答 3

4

您的 AdMob 库找不到 CJSONDeserializer 或 CJSONSerializer 类,我认为它们来自 libTouchJSON.a。通常这意味着您的 libTouchJSON.a 未包含在您的项目中。您应该仔细检查所有额外的参数,并确保您的 libTouchJSON 不是拇指并且包含您尝试链接的所有架构(x86 用于模拟器,armv6 用于设备)

于 2010-11-24T20:47:02.663 回答
0

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)

于 2011-01-05T08:42:09.127 回答
0

由于很多人会发现这个问题,您可以在此处https://github.com/dalexsoto/AlexTouch.GoogleAdMobAds使用发布在 github 上的最新 monotouch 绑定

这是一个如何使用它以及如何订阅它的事件的示例

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());
}
于 2012-02-12T03:19:31.527 回答