Authored by 朱小军

删除大数据上报定位代码 reivew by 孟顺

Pod::Spec.new do |s|
s.name = "YH_Analytics"
s.version = "3.1.5"
s.version = "3.1.6"
s.summary = "Analytics Kit"
s.description = <<-DESC
Analytics Kit
... ...
... ... @@ -45,12 +45,7 @@
E7ADAE3C1AB946C100C9DD0B /* YHError.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE361AB946C100C9DD0B /* YHError.m */; };
E7ADAE3D1AB946C100C9DD0B /* YHEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE381AB946C100C9DD0B /* YHEvent.m */; };
E7ADAE3E1AB946C100C9DD0B /* YHStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE3A1AB946C100C9DD0B /* YHStatus.m */; };
E7ADAE431AB9479600C9DD0B /* YHDataFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE421AB9479600C9DD0B /* YHDataFactory.m */; };
E7ADAE461AB9487A00C9DD0B /* YHAnalyItemData.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE451AB9487A00C9DD0B /* YHAnalyItemData.m */; };
E7ADAE491AB94E3A00C9DD0B /* YHErrorFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE481AB94E3A00C9DD0B /* YHErrorFactory.m */; };
E7ADAE4F1AB94E7A00C9DD0B /* YHDeviceFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE4E1AB94E7A00C9DD0B /* YHDeviceFactory.m */; };
E7ADAE551AB94EBD00C9DD0B /* YHEventFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE541AB94EBD00C9DD0B /* YHEventFactory.m */; };
E7ADAE581AB94ED400C9DD0B /* YHStatusFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE571AB94ED400C9DD0B /* YHStatusFactory.m */; };
E7ADAE5B1AB95BC800C9DD0B /* YHAssemblyAssistant.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADAE5A1AB95BC800C9DD0B /* YHAssemblyAssistant.m */; };
E7B8DE221A81D68600102CC4 /* NSString+YHAnalytics.m in Sources */ = {isa = PBXBuildFile; fileRef = E7B8DE211A81D68600102CC4 /* NSString+YHAnalytics.m */; };
E7B8DE461A81ED8F00102CC4 /* YHNetworkUserAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = E7B8DE451A81ED8F00102CC4 /* YHNetworkUserAgent.m */; };
... ... @@ -155,18 +150,8 @@
E7ADAE381AB946C100C9DD0B /* YHEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHEvent.m; sourceTree = "<group>"; };
E7ADAE391AB946C100C9DD0B /* YHStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHStatus.h; sourceTree = "<group>"; };
E7ADAE3A1AB946C100C9DD0B /* YHStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHStatus.m; sourceTree = "<group>"; };
E7ADAE411AB9479600C9DD0B /* YHDataFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHDataFactory.h; sourceTree = "<group>"; };
E7ADAE421AB9479600C9DD0B /* YHDataFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHDataFactory.m; sourceTree = "<group>"; };
E7ADAE441AB9487A00C9DD0B /* YHAnalyItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHAnalyItemData.h; sourceTree = "<group>"; };
E7ADAE451AB9487A00C9DD0B /* YHAnalyItemData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHAnalyItemData.m; sourceTree = "<group>"; };
E7ADAE471AB94E3A00C9DD0B /* YHErrorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHErrorFactory.h; sourceTree = "<group>"; };
E7ADAE481AB94E3A00C9DD0B /* YHErrorFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHErrorFactory.m; sourceTree = "<group>"; };
E7ADAE4D1AB94E7A00C9DD0B /* YHDeviceFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHDeviceFactory.h; sourceTree = "<group>"; };
E7ADAE4E1AB94E7A00C9DD0B /* YHDeviceFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHDeviceFactory.m; sourceTree = "<group>"; };
E7ADAE531AB94EBD00C9DD0B /* YHEventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHEventFactory.h; sourceTree = "<group>"; };
E7ADAE541AB94EBD00C9DD0B /* YHEventFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHEventFactory.m; sourceTree = "<group>"; };
E7ADAE561AB94ED400C9DD0B /* YHStatusFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHStatusFactory.h; sourceTree = "<group>"; };
E7ADAE571AB94ED400C9DD0B /* YHStatusFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHStatusFactory.m; sourceTree = "<group>"; };
E7ADAE591AB95BC800C9DD0B /* YHAssemblyAssistant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHAssemblyAssistant.h; sourceTree = "<group>"; };
E7ADAE5A1AB95BC800C9DD0B /* YHAssemblyAssistant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHAssemblyAssistant.m; sourceTree = "<group>"; };
E7B8DE201A81D68600102CC4 /* NSString+YHAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+YHAnalytics.h"; path = "../NSString+YHAnalytics.h"; sourceTree = "<group>"; };
... ... @@ -293,7 +278,6 @@
194EDC991A7F553600421E6C /* YH_Analytics */ = {
isa = PBXGroup;
children = (
E7ADAE401AB9475300C9DD0B /* Factory */,
E7ADAE321AB946C100C9DD0B /* Model */,
E7B8DE431A81ED8F00102CC4 /* Utils */,
E7B8DE261A81DCBD00102CC4 /* YHAnalyticsDependencies */,
... ... @@ -413,23 +397,6 @@
path = Model;
sourceTree = "<group>";
};
E7ADAE401AB9475300C9DD0B /* Factory */ = {
isa = PBXGroup;
children = (
E7ADAE411AB9479600C9DD0B /* YHDataFactory.h */,
E7ADAE421AB9479600C9DD0B /* YHDataFactory.m */,
E7ADAE471AB94E3A00C9DD0B /* YHErrorFactory.h */,
E7ADAE481AB94E3A00C9DD0B /* YHErrorFactory.m */,
E7ADAE4D1AB94E7A00C9DD0B /* YHDeviceFactory.h */,
E7ADAE4E1AB94E7A00C9DD0B /* YHDeviceFactory.m */,
E7ADAE531AB94EBD00C9DD0B /* YHEventFactory.h */,
E7ADAE541AB94EBD00C9DD0B /* YHEventFactory.m */,
E7ADAE561AB94ED400C9DD0B /* YHStatusFactory.h */,
E7ADAE571AB94ED400C9DD0B /* YHStatusFactory.m */,
);
path = Factory;
sourceTree = "<group>";
};
E7B8DE261A81DCBD00102CC4 /* YHAnalyticsDependencies */ = {
isa = PBXGroup;
children = (
... ... @@ -642,19 +609,14 @@
194EDC7C1A7F52D100421E6C /* ViewController.m in Sources */,
E7B8DE221A81D68600102CC4 /* NSString+YHAnalytics.m in Sources */,
E7B8DE4A1A81EE0A00102CC4 /* OpenUDID.m in Sources */,
E7ADAE4F1AB94E7A00C9DD0B /* YHDeviceFactory.m in Sources */,
E7ADAE3D1AB946C100C9DD0B /* YHEvent.m in Sources */,
194EDC9C1A7F555800421E6C /* YH_Analytics.m in Sources */,
E7ADAE431AB9479600C9DD0B /* YHDataFactory.m in Sources */,
CA5FDA2A1AEE302F00F86398 /* YHNetworkService.m in Sources */,
E7ADAE3E1AB946C100C9DD0B /* YHStatus.m in Sources */,
194EDC791A7F52D100421E6C /* AppDelegate.m in Sources */,
E7B8DE461A81ED8F00102CC4 /* YHNetworkUserAgent.m in Sources */,
E7B8DE521A823EEB00102CC4 /* YHCrashReporter.m in Sources */,
E7ADAE461AB9487A00C9DD0B /* YHAnalyItemData.m in Sources */,
E7ADAE581AB94ED400C9DD0B /* YHStatusFactory.m in Sources */,
E7ADAE491AB94E3A00C9DD0B /* YHErrorFactory.m in Sources */,
E7ADAE551AB94EBD00C9DD0B /* YHEventFactory.m in Sources */,
E7A908731BB3C4B000E2EA39 /* YHPerformance.m in Sources */,
047381071EADEE970007E850 /* JTSHardwareInfo.m in Sources */,
E7ADAE3B1AB946C100C9DD0B /* YHDevice.m in Sources */,
... ...
... ... @@ -6,7 +6,6 @@
// Copyright (c) 2015年 YOHO. All rights reserved.
//
#import <CoreLocation/CoreLocation.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import "YHNetworkService.h"
... ... @@ -28,13 +27,9 @@ static dispatch_queue_t persisting_queue() {
return persisting_queue;
}
@interface YHAssemblyAssistant () <CLLocationManagerDelegate>
@interface YHAssemblyAssistant ()
/**
* 定位服务
*/
@property (strong, nonatomic) CLLocationManager *locationManager;
/**
* 设备信息
*/
@property (strong, nonatomic) YHDevice *device;
... ... @@ -77,8 +72,6 @@ static dispatch_queue_t persisting_queue() {
@property (strong, nonatomic) NSMutableArray *tempPerformanceArray;
// 启动定位服务
- (void)startLocationService;
// 开启网络状态监测
- (void)startObserverNetworkReachabilityStatus;
// 将一个事件写入到文件
... ... @@ -95,10 +88,6 @@ static dispatch_queue_t persisting_queue() {
- (void)removeLocalFile;
// 更新网络状态
- (BOOL)updateNetWorkStatus:(NSString *)status;
// 更新位置信息
- (BOOL)updateLocation:(CLLocation *)location;
// 更新立即上传信息
- (void)updateImmediUploadDic;
// 将临时缓存的事件队列写入到文件
- (void)writeTempEventArray;
... ... @@ -136,9 +125,6 @@ static dispatch_queue_t persisting_queue() {
- (void)dealloc
{
[self.locationManager stopUpdatingLocation];
self.locationManager.delegate = nil;
self.locationManager = nil;
self.fileManager = nil;
self.device = nil;
self.currentStatus = nil;
... ... @@ -171,18 +157,6 @@ static dispatch_queue_t persisting_queue() {
return _eventFileName;
}
- (CLLocationManager *)locationManager
{
if (!_locationManager) {
_locationManager = [[CLLocationManager alloc]init];
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 精度越高,越费电,根据需要设定
_locationManager.distanceFilter = 1000; // 位置移动1000米,发一次更新消息
}
return _locationManager;
}
- (NSMutableArray *)tempEventArray
{
if (!_tempEventArray) {
... ... @@ -239,7 +213,6 @@ static dispatch_queue_t persisting_queue() {
[self startObserverNetworkReachabilityStatus];
[self startLocationService];
}
- (void)uploadFirstLaunchApp
... ... @@ -556,20 +529,6 @@ static dispatch_queue_t persisting_queue() {
}];
}
// 启动定位服务
- (void)startLocationService
{
//判断用户定位服务是否开启
if ([CLLocationManager locationServicesEnabled]) {
[self.locationManager startUpdatingLocation];
} else {
//不能定位用户的位置
//1.提醒用户检查当前的网络状况
//2.提醒用户打开定位开关
YALog(@"请检查网络状况,打开定位开关。");
}
}
// 更新网络状态
- (BOOL)updateNetWorkStatus:(NSString *)status
{
... ... @@ -585,35 +544,6 @@ static dispatch_queue_t persisting_queue() {
return YES;
}
- (BOOL)updateLocation:(CLLocation *)location
{
if (location == nil || ![location isKindOfClass:[CLLocation class]]) {
#ifdef DEBUG
NSException *exception = [NSException exceptionWithName:NSInvalidArgumentException
reason:@"The input parameter is nil or an unexpected value."
userInfo:nil];
[exception raise];
#endif
return NO;
}
NSNumber *loNumber = [NSNumber numberWithDouble:location.coordinate.longitude];
NSNumber *laNumber = [NSNumber numberWithDouble:location.coordinate.latitude];
NSString *lo = [loNumber stringValue];
NSString *la = [laNumber stringValue];
YALog(@"newLocation: {longitude:%@, latitude:%@}", lo, la);
if ([lo isEqualToString:self.currentStatus.lo] && [la isEqualToString:self.currentStatus.la]) {
return NO;
}
// 更新经纬度
self.currentStatus.lo = lo;
self.currentStatus.la = la;
return YES;
}
// 更新立即上传的status信息
- (void)updateImmediUploadDicStatus
{
... ... @@ -1043,57 +973,6 @@ static dispatch_queue_t persisting_queue() {
}
}
#pragma mark - CLLocationManagerDelegate
// 返回定位服务认证状态的委托方法
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status) {
case kCLAuthorizationStatusNotDetermined: {
if ([manager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[manager requestAlwaysAuthorization];
}
// if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
// manager.allowsBackgroundLocationUpdates = YES;
// }
}
break;
case kCLAuthorizationStatusRestricted:
//定位服务无法使用,请开启手机定位服务
break;
case kCLAuthorizationStatusDenied:
//程序定位服务未开启, 您需要去设置界面启用我们App定位服务
break;
default:
break;
}
}
//协议中的方法,作用是每当位置发生更新时会调用的委托方法
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
//locations数组里边存放的是CLLocation对象,一个CLLocation对象就代表着一个位置
CLLocation *newLocation = [locations firstObject];
if ([self updateLocation:newLocation]) {
[self updateImmediUploadDicStatus];
}
}
//当位置获取或更新失败会调用的方法
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSString *errorMsg = nil;
if ([error code] == kCLErrorDenied) {
errorMsg = @"定位功能访问被拒绝";
}
if ([error code] == kCLErrorLocationUnknown) {
errorMsg = @"获取位置信息失败";
}
YALog(@"%@", errorMsg);
}
- (void)setTDID:(NSString *)tdid
{
[self.device setTdid:tdid];
... ...