0
votes
    +(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

use FIRAnalytics like this,

but it print error below:

FIRAnalytics/DEBUG> No network. Upload task will not be scheduled

and these:

2016-10-10 15:01:58.038 newPatient[8480:] FIRAnalytics/DEBUG> Do not schedule an upload task. Task already exists

2016-10-10 15:02:07.134 newPatient[8480:] FIRAnalytics/DEBUG> Network status has changed. Code, status: 1, Disconnected 2016-10-10 15:02:07.136 newPatient[8480:] FIRAnalytics/ERROR> Encounter network error. Code, error: -1003, Error Domain=NSURLErrorDomain Code=-1003 "未能找到使用指定主机名的服务器。" UserInfo={NSUnderlyingError=0x7fbf305dcd30 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" 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> Fetched configuration. Status code: 0

2016-10-10 15:02:07.138 newPatient[8480:] FIRAnalytics/DEBUG> Unable to get the configuration from server. Network request failed. Code, Error: 0, Error Domain=NSURLErrorDomain Code=-1003 "未能找到使用指定主机名的服务器。" UserInfo={NSUnderlyingError=0x7fbf305dcd30 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" 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> Network fetch failed. Will retry later. Code, error: 0, Error Domain=NSURLErrorDomain Code=-1003 "未能找到使用指定主机名的服务器。" UserInfo={NSUnderlyingError=0x7fbf305dcd30 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" 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> No network. Upload task will not be scheduled 2016-10-10 15:02:07.139 newPatient[8480:] FIRAnalytics/DEBUG> Canceling active timer 2016-10-10 15:02:27.958 newPatient[8480:13764850] Firebase/Network/ERROR> Encounter network error. Code, error: -1001, Error Domain=NSURLErrorDomain Code=-1001 "请求超时。" 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] Error posting to Clearcut: Error Domain=NSURLErrorDomain Code=-1001 "请求超时。" UserInfo={NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSErrorFailingURLKey=https://play.googleapis.com/log, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2103, NSLocalizedDescription=请求超时。}, with Status Code: 0 debug logs below:

2016-10-10 11:38:58.152 newPatient[7428:] FIRAnalytics/DEBUG> Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: page, { "_dbg" = 1; "_o" = app; "_r" = 1; pageName = HDFPhDoctorIntroduceViewController; }

1
What's your question? - Frank van Puffelen
I think the network is good , why FIRAnalytics print "No network. Upload task will not be scheduled",and this status will stop FIRAnalytics work normal. @Frank van Puffelen - user5176302
It later prints Upload task scheduled to be executed in approx. (s): 9.89369398355484 2016-10-10 11:35:33.101. I wouldn't derive whether a program works from scanning the log files. That's sort of a XY problem. Instead, if you see problematic behavior, describe the behavior you see vs what you expected and then use the log files to see if we can use those to explain the behavior. - Frank van Puffelen
sorry! I did not say clearly. Please look the logs I had copy just.The log:"FIRAnalytics/DEBUG> No network. Upload task will not be scheduled" and "error: -1001" ,I don't know this words if say "FIRAnalytics is not work normal",so I ask this question. And the other request in may ios app is good . - user5176302

1 Answers

0
votes

There is either no network connection or your network condition is flaky that it could not send data to the server. If there is no network, it will not schedule upload task. Sometimes, depending on where you are from, the network traffic might be filtered so it also fail to upload data. I think this is normal behavior.