2010-11-24 50 views
1

適用於iPhone的admob sdk使用專有的libAdMobNoThumb.a庫和基於Objective-C源的TouchJSON庫。TouchJSON的Monotouch綁定?

有人知道TouchJSON的C#綁定,以便我們可以包含它嗎?

還是有人知道如何建立一個可以包含的庫?

我們用Xcode創建了一個iPhone Library項目並添加了完整的TouchJSON源代碼樹。我們已經比掛鉤導致測試iPhone應用程序libTouchJSON.a具有以下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,Mollyke。

回答

4

您的AdMob庫找不到CJSONDeserializer或CJSONSerializer類,我認爲它們來自libTouchJSON.a。通常這意味着您的libTouchJSON.a未包含在您的項目中。你應該仔細檢查你的所有額外的參數,並確保您的libTouchJSON是不是拇指和包括所有你想要的鏈接(X86的模擬器,爲的ARMv6設備)

+0

傑夫,你是最好的例子!我們製作了一個不錯的模擬器libTouchJSON.a版本,並與它聯繫在一起,並與賓果遊戲相關聯。 – guivho 2010-11-25 08:08:43

0

埃裏克架構,

對不起,延遲,但最近我一直忙於純粹的Xcode項目。讓我告訴你我是如何創建一個TouchJSON庫的。

我用xcode創建了一個庫項目,並複製了最新的admob庫附帶的TouchJSON源代碼。我構建了兩個nothumb發行版本,一個用於模擬器,另一個用於設備。這會產生兩個庫。爲了方便在MT項目中使用它們,我使用了lipo工具將它們組合成一個胖子庫。脂肪庫很方便,因爲它們可以在模擬器以及設備構建中使用。完整的項目,包括胖庫libTouchJSON.a和用於構建胖女人的腳本,都存在於http://www.filedropper.com/touchjson的zip文件中。

(注:這是張貼在回答我最初的問題,因爲它是稍微有點長被接受作爲由Eric S上的問題,評論)

0

由於很多人會發現這個問題,你可以使用最新的MonoTouch綁定的AdMob這裏https://github.com/dalexsoto/AlexTouch.GoogleAdMobAds

發佈在github這裏是如何使用它,以及如何suscribe其事件

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()); 
}