+(void)load
{
[super load];
[self aspect_hookSelector:@selector(viewWillAppear:) withOptions:0 usingBlock:^(id<AspectInfo> info, BOOL animated) {
HDFAppLog(@"**************==");
NSString *currentPageName = [[info instance] hdf_className]; //页面名称,如:HDFSearchHospitalViewController
//FireBaseAnalytics
[FIRAnalytics logEventWithName:"page" parameters:{
"pageName":currentPageName
}];
//GoogleAnalystics
id<GAITracker> tracker = [GAI sharedInstance].defaultTracker; //调用默认跟踪器
[tracker set:kGAIScreenName value:currentPageName];
[tracker send:[[GAIDictionaryBuilder createScreenView]build]];
} error:NULL];
}
end
使用像这样的FIRAnalytics,
但下面打印错误:
FIRAnalytics / DEBUG&GT;没有网络。上传任务不会被安排
和这些:
2016-10-10 15:01:58.038 newPatient [8480:] FIRAnalytics / DEBUG&gt;不要安排上传任务。任务已存在
2016-10-10 15:02:07.134 newPatient [8480:] FIRAnalytics / DEBUG&gt;网络状态已更改。代码,状态:1,已断开连接 2016-10-10 15:02:07.136 newPatient [8480:] FIRAnalytics / ERROR&gt;遇到网络错误。代码,错误:-1003,错误域= NSURLErrorDomain代码= -1003&#34;未能找到使用指定主机名的服务器。&#34; UserInfo = {NSUnderlyingError = 0x7fbf305dcd30 {错误域= kCFErrorDomainCFNetwork代码= -1003&#34;(null)&#34; UserInfo = {_ kCFStreamErrorCodeKey = 8,_kCFStreamErrorDomainKey = 12}},NSErrorFailingURLStringKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,NSErrorFailingURLKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,_ kCFStreamErrorDomainKey = 12,_kCFStreamErrorCodeKey = 8,NSLocalizedDescription =未找到到使用指定主机名的服务器。}
2016-10-10 15:02:07.138 newPatient [8480:] FIRAnalytics / DEBUG&gt;获取配置。状态代码:0
2016-10-10 15:02:07.138 newPatient [8480:] FIRAnalytics / DEBUG&gt;无法从服务器获取配置。网络请求失败。代码,错误:0,错误域= NSURLErrorDomain代码= -1003&#34;未能找到使用指定主机名的服务器。&#34; UserInfo = {NSUnderlyingError = 0x7fbf305dcd30 {错误域= kCFErrorDomainCFNetwork代码= -1003&#34;(null)&#34; UserInfo = {_ kCFStreamErrorCodeKey = 8,_kCFStreamErrorDomainKey = 12}},NSErrorFailingURLStringKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,NSErrorFailingURLKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,_ kCFStreamErrorDomainKey = 12,_kCFStreamErrorCodeKey = 8,NSLocalizedDescription =未找到到使用指定主机名的服务器。}
2016-10-10 15:02:07.139 newPatient [8480:] FIRAnalytics / DEBUG&gt;网络提取失败。稍后再试。代码,错误:0,错误域= NSURLErrorDomain代码= -1003&#34;未能找到使用指定主机名的服务器。&#34; UserInfo = {NSUnderlyingError = 0x7fbf305dcd30 {错误域= kCFErrorDomainCFNetwork代码= -1003&#34;(null)&#34; UserInfo = {_ kCFStreamErrorCodeKey = 8,_kCFStreamErrorDomainKey = 12}},NSErrorFailingURLStringKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,NSErrorFailingURLKey = https://app-measurement.com/config/app/1:442821079824:ios:88cc404211cdcfea?platform=ios&app_instance_id=1419B4CCA10A4607861CEDB35CB95174&gmp_version=3403,_ kCFStreamErrorDomainKey = 12,_kCFStreamErrorCodeKey = 8,NSLocalizedDescription =未找到到使用指定主机名的服务器。}
2016-10-10 15:02:07.139 newPatient [8480:] FIRAnalytics / DEBUG&gt;没有网络。上传任务不会被安排 2016-10-10 15:02:07.139 newPatient [8480:] FIRAnalytics / DEBUG&gt;取消活动计时器 2016-10-10 15:02:27.958 newPatient [8480:13764850] Firebase / Network / ERROR&gt;遇到网络错误。代码,错误:-1001,错误域= NSURLErrorDomain代码= -1001&#34;请求超时。&#34; UserInfo = {NSErrorFailingURLStringKey = https://play.googleapis.com/log,NSErrorFailingURLKey = https://play.googleapis.com/log,_ kCFStreamErrorDomainKey = 4,_kCFStreamErrorCodeKey = -2103,NSLocalizedDescription =请求超时。} 2016-10-10 15:02:27.961 newPatient [8480] [Firebase / Core] [I-COR000020]错误发布到Clearcut:错误域= NSURLErrorDomain代码= -1001&#34;请求超时。&#34; UserInfo = {NSErrorFailingURLStringKey = https://play.googleapis.com/log,NSErrorFailingURLKey = https://play.googleapis.com/log,_ kCFStreamErrorDomainKey = 4,_kCFStreamErrorCodeKey = -2103,NSLocalizedDescription =请求超时。},状态码:0 调试日志如下:
2016-10-10 11:38:58.152 newPatient [7428:] FIRAnalytics / DEBUG&gt;调试模式已启用。将事件标记为调试和实时。事件名称,参数:page,{ &#34; _dbg&#34; = 1; &#34; _O&#34; = app; &#34; _r&#34; = 1; pageName = HDFPhDoctorIntroduceViewController; }
答案 0 :(得分:0)
没有网络连接,或者您的网络条件不稳定,无法将数据发送到服务器。如果没有网络,则不会安排上传任务。有时,根据您所在的位置,网络流量可能会被过滤,因此也无法上传数据。我认为这是正常行为。