我正在尝试在单点触控应用程序上启动并运行谷歌分析,但没有任何事件成功发送,NSError 对象始终为空。委托上的 DispatchCompleted 方法始终打印“成功:0 - 失败:n”,n = 队列中的页面浏览量。
我从这个 url 运行了 makefile: https ://github.com/mono/monotouch-bindings/tree/master/GoogleAnalytics 它生成了一个 GoogleAnalytics.dll 文件,我试图用它来跟踪。
这是测试应用程序的代码示例:
public partial class TestAnalyticsViewController : UIViewController
{
private GanDelegate _delegate;
public override void ViewDidLoad ()
{
_delegate = new GanDelegate();
GoogleAnalytics.GANTracker.SharedTracker.StartTracker("our_id", 0, _delegate);
NSError error;
GoogleAnalytics.GANTracker.SharedTracker.TrackPageView("/Home", out error);
GoogleAnalytics.GANTracker.SharedTracker.Dispatch();
base.ViewDidLoad ();
}
}
public class GanDelegate: GoogleAnalytics.GANTrackerDelegate
{
public override void DispatchCompleted (GoogleAnalytics.GANTracker tracker, int eventsDispatched, int eventsFailedDispatch)
{
Console.WriteLine("Successful: {0} - Failed: {1}", eventsDispatched.ToString(), eventsFailedDispatch.ToString());
}
}
我也尝试从设备上卸载应用程序并从头开始,但没有运气。