我一直在开发iphone应用程序,自从测试版7.1出来后,我无法为64位设备编译应用程序我收到错误:
“二进制表达式的操作数无效('BOOL'(又名'signed char')和'void')”
问题是以前版本的应用程序使用google anaytics v2并且新iOS中不支持该版本,但是我将他们的sdk和他们的“迁移”手册添加到v3,但是我无法使其工作,这里是一个问题:
之前正在运行的代码
BOOL returnValue = YES;
if(tracking1) {
id tracker1 = [[GAI sharedInstance] trackerWithTrackingId:tracking1];
[tracker1 setCustom:1 dimension:con];
[tracker1 setCustom:2 dimension:mod];
returnValue &= [tracker1 sendView:screen];
}
if(tracking2) {
id tracker2 = [[GAI sharedInstance] trackerWithTrackingId:tracking2];
[tracker2 setCustom:1 dimension:con];
[tracker2 setCustom:2 dimension:mod];
returnValue &= [tracker2 sendView:screen];
}
return returnValue;
根据谷歌的手册,我改为这个新代码
BOOL returnValue = YES;
if(tracking1) {
id tracker1 = [[GAI sharedInstance] trackerWithTrackingId:tracking1];
// Set the custom dimension value on the tracker using its index.
[tracker1 set:[GAIFields customDimensionForIndex:1] value:con];
[tracker1 set:[GAIFields customDimensionForIndex:2] value:mod];
[tracker1 set:kGAIScreenName value:screen];
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once, so it is set on the Map,
// not the tracker.
returnValue &= [tracker1 send:[[GAIDictionaryBuilder createAppView] build]];
}
if(tracking2) {
id tracker2 = [[GAI sharedInstance] trackerWithTrackingId:tracking2];
// Set the custom dimension value on the tracker using its index.
[tracker2 set:[GAIFields customDimensionForIndex:1] value:con];
[tracker2 set:[GAIFields customDimensionForIndex:2] value:mod];
[tracker2 set:kGAIScreenName value:screen];
returnValue &= [tracker2 send:[[GAIDictionaryBuilder createAppView] build]];
}
return returnValue;
并且我的returnValue& = [tracker ...]正在突出显示,并向我显示我发布的错误。
答案 0 :(得分:1)
send
中的 GAITracker.h
方法不会返回任何内容:
/*!
Queue tracking information with the given parameter values.
@param parameters A map from parameter names to parameter values which will be
set just for this piece of tracking information, or nil for none.
*/
- (void)send:(NSDictionary *)parameters;
只需删除分配returnValue &= ...