1
這是我第一次爲iPhone開發鈦模塊。我正在爲iPhone構建Google Analytics模塊。鈦iPhone模塊
如果我要使用XCode實施Google Analytics,則可以使用didFinishLaunchingWithOptions委託。下面是這個例子:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXXXXXX-X"];
return YES;
}
我試過了,它完全適合我。
說到鈦模塊,我認爲沒有委託,如didFinishLaunchingWithOptions。
我把它放在下面的啓動功能:
-(void)startup
{
// this method is called when the module is first loaded
// you *must* call the superclass
[super startup];
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-38803610-1"];
NSLog(@"[INFO] %@ loaded",self);
}
,但是當我執行我的應用程序如下圖所示:
var mod = require("com.mymodule")
Ti.API.log("The module: " + mod)
我收到以下錯誤:
: Dispatcher initialization failed: Error Domain=com.google.analytics.error Code=1 "Dispatcher must be initialized on main thread." UserInfo=0xb3d1270 {NSLocalizedDescription=Dispatcher must be initialized on main thread.}
任何幫助將appriciated。提前致謝。
嘿,非常感謝。得到它的工作... – senthil 2013-03-07 07:52:44
@senthil:高興:) – 2013-03-07 07:55:56