Commit a8d09ef3 authored by 汪洋's avatar 汪洋

解决冲突

parents 91445fa1 89353463
PODS:
- GMCache (0.1.1):
- TMCache (~> 2.1.0)
- GMPhobos (0.4.1):
- GMPhobos (0.4.2):
- GMCache (~> 0.1.1)
- TMCache (2.1.0)
......@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMPhobos: 2fd07df959c1c5f773a3e2355930fcbcf4ddf38c
GMPhobos: 9799825c107481252f084a3a2f91d5d1eae1d7bd
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
......
{
"name": "GMPhobos",
"version": "0.4.1",
"version": "0.4.2",
"summary": "GM statistic data sdk",
"description": "GM event track sdk.",
"homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos",
......@@ -10,7 +10,7 @@
},
"source": {
"git": "git@git.gengmei.cc:gengmeiios/GMPhobos.git",
"tag": "0.4.1"
"tag": "0.4.2"
},
"platforms": {
"ios": "8.0"
......
PODS:
- GMCache (0.1.1):
- TMCache (~> 2.1.0)
- GMPhobos (0.4.1):
- GMPhobos (0.4.2):
- GMCache (~> 0.1.1)
- TMCache (2.1.0)
......@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMPhobos: 2fd07df959c1c5f773a3e2355930fcbcf4ddf38c
GMPhobos: 9799825c107481252f084a3a2f91d5d1eae1d7bd
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.1</string>
<string>0.4.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "GMPhobos"
s.version = "0.4.2"
s.version = "0.4.3"
s.summary = "GM statistic data sdk"
s.description = <<-DESC
......
......@@ -94,7 +94,15 @@ static NSString *sdkVersion = @"110";
- (void)handleEventDeviceOpened{
WMCacheService *cache = [WMCacheService sharedInstance];
/** 每次打开APP埋点 **/
[Phobos track:@"device_opened" attributes:@{} sendNow:YES];
NSDictionary *dict = @{@"build_cpu_abi": [PhobosUtil currentDeviceCPUType],
@"cpu_count": [PhobosUtil currentDeviceCPUCount],
@"mac_address": [PhobosUtil getMacAddress],
@"phone_operator": [PhobosUtil getTelephonyInfo],
@"total_memory": [PhobosUtil getTotalMemorySize],
@"run_time": [PhobosUtil deviceRunTime],
@"uuid": [PhobosUtil deviceId],
};
[Phobos track:@"device_opened" attributes:dict sendNow:YES];
/** 第一次打开APP埋点 **/
if (![cache fetchObjectAtDiskWithkey:PhobosHaveOpenApp]) {
......@@ -197,7 +205,15 @@ static NSString *sdkVersion = @"110";
NSDate *date = [NSDate date];
double endTime = [date timeIntervalSince1970];
NSString *usedTime = [NSString stringWithFormat:@"%ld",(long)(endTime - beginTime)];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:usedTime,@"duration",nil];
NSDictionary *dict = @{@"duration":usedTime,
@"build_cpu_abi": [PhobosUtil currentDeviceCPUType],
@"cpu_count": [PhobosUtil currentDeviceCPUCount],
@"mac_address": [PhobosUtil getMacAddress],
@"phone_operator": [PhobosUtil getTelephonyInfo],
@"total_memory": [PhobosUtil getTotalMemorySize],
@"run_time": [PhobosUtil deviceRunTime],
@"uuid": [PhobosUtil deviceId],
};
[Phobos track:@"on_app_session_over" attributes:dict];
[cache removeObjectAtDiskWithkey:PhobosBeginTime];
//当前session结束之后,把id置为0
......@@ -426,7 +442,7 @@ static NSString *sdkVersion = @"110";
让sendArray方法负责发送,数据一旦转移到缓存区,就把原有的数据干掉。
@author zhaiguojun 16-10-17 in (null)
@param array 参数
@param clean 是否立即清楚缓存
@param clean 是否立即清楚缓存
*/
- (void)sendArray:(NSArray *)array cleanCacheRightNow:(BOOL)clean {
@try {
......
......@@ -40,4 +40,39 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
* 获取IP地址
*/
+ (NSString *)getIPAddress:(BOOL)preferIPv4;
/**
* 获取cup指令集
*/
+ (NSString *)currentDeviceCPUType;
/***
* CPU总数目
**/
+ (NSString *)currentDeviceCPUCount;
/***
* 网卡地址
**/
+ (NSString *)getMacAddress;
/**
* 获取运营商信息
*/
+ (NSString *)getTelephonyInfo;
/**
* 内存大小,单位:兆
*/
+ (NSString *)getTotalMemorySize;
/**
* 获取手机运行时间,从开机到现在
*/
+ (NSString *)deviceRunTime;
@end
......@@ -13,6 +13,13 @@
#import <ifaddrs.h>
#import <arpa/inet.h>
#import <net/if.h>
#import <net/if_dl.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <sys/types.h>
#import <sys/sysctl.h>
#import <mach/machine.h>
#import "sys/utsname.h"
#import "Phobos.h"
#define IOS_CELLULAR @"pdp_ip0"
......@@ -221,10 +228,6 @@
NSTextCheckingResult *firstMatch=[regex firstMatchInString:ipAddress options:0 range:NSMakeRange(0, [ipAddress length])];
if (firstMatch) {
// NSRange resultRange = [firstMatch rangeAtIndex:0];
// NSString *result=[ipAddress substringWithRange:resultRange];
// //输出结果
// NSLog(@"%@",result);
return YES;
}
}
......@@ -269,4 +272,134 @@
return [addresses count] ? addresses : nil;
}
/**
* 这里就叫做CPU指令集吧,目前主要采集这四种,armv6、armv7、armv7s、arm64
*/
+ (NSString *)currentDeviceCPUType {
NSMutableString *cpuType = [[NSMutableString alloc] init];
size_t size;
cpu_type_t type;
cpu_subtype_t subtype;
size = sizeof(type);
sysctlbyname("hw.cputype", &type, &size, NULL, 0);
size = sizeof(subtype);
sysctlbyname("hw.cpusubtype", &subtype, &size, NULL, 0);
if (type == CPU_TYPE_X86) {
[cpuType appendString:@"x86"];
} else if (type == CPU_TYPE_ARM) {
[cpuType appendString:@"ARM"];
switch(subtype) {
case CPU_SUBTYPE_ARM_V6:
[cpuType appendString:@"V6"];
break;
case CPU_SUBTYPE_ARM_V7:
[cpuType appendString:@"V7"];
break;
case CPU_SUBTYPE_ARM_V7S:
[cpuType appendString:@"V7s"];
break;
}
} else if (type == CPU_TYPE_ARM64) {
[cpuType appendString:@"ARM64"];
} else {
// 暂时不采集其他的
[cpuType appendString:@"nuknow type"];
}
return cpuType;
}
/***
* CPU总数目
**/
+ (NSString *)currentDeviceCPUCount {
NSInteger count = [NSProcessInfo processInfo].activeProcessorCount;
return [NSString stringWithFormat:@"%ld", (long)count];
}
/***
* 网卡地址
**/
+ (NSString *)getMacAddress {
int mib[6];
size_t len;
char *buf;
unsigned char *ptr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
mib[0] = CTL_NET;
mib[1] = AF_ROUTE;
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
if ((mib[5] = if_nametoindex("en0")) == 0) {
printf("Error: if_nametoindex error/n");
return NULL;
}
if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
printf("Error: sysctl, take 1/n");
return NULL;
}
if ((buf = malloc(len)) == NULL) {
printf("Could not allocate memory. error!/n");
return NULL;
}
if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
printf("Error: sysctl, take 2");
return NULL;
}
ifm = (struct if_msghdr *)buf;
sdl = (struct sockaddr_dl *)(ifm + 1);
ptr = (unsigned char *)LLADDR(sdl);
NSString *outstring = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x", *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)];
free(buf);
return [outstring uppercaseString];
}
/**
* 获取运营商信息
*/
+ (NSString *)getTelephonyInfo {
CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [info subscriberCellularProvider];
if (carrier == nil) {
return @"";
}
return [carrier carrierName] != nil ? [carrier carrierName] : @"";
}
/**
* 内存大小,单位:兆
*/
+ (NSString *)getTotalMemorySize {
unsigned long long resultSize = [NSProcessInfo processInfo].physicalMemory/1024/1024;
return [NSString stringWithFormat:@"%llu", resultSize];
}
/**
* 获取手机运行时间,从开机到现在
*/
+ (NSString *)deviceRunTime {
struct timeval boottime;
int mib[2] = {CTL_KERN, KERN_BOOTTIME};
size_t size = sizeof(boottime);
time_t now;
time_t uptime = -1;//默认为没有使用吧
(void)time(&now);
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && boottime.tv_sec != 0) {
uptime = now - boottime.tv_sec;
}
return [NSString stringWithFormat:@"%ld", uptime];
}
@end
......@@ -5,67 +5,67 @@
<testcase classname="fastlane.lanes" name="00: Verifying required fastlane version" time="0.001983">
<testcase classname="fastlane.lanes" name="00: Verifying required fastlane version" time="0.002051">
</testcase>
<testcase classname="fastlane.lanes" name="01: default_platform" time="0.001661">
<testcase classname="fastlane.lanes" name="01: default_platform" time="0.001753">
</testcase>
<testcase classname="fastlane.lanes" name="02: import_from_git" time="2.569052">
<testcase classname="fastlane.lanes" name="02: import_from_git" time="0.580914">
</testcase>
<testcase classname="fastlane.lanes" name="03: git_pull" time="4.603808">
<testcase classname="fastlane.lanes" name="03: git_pull" time="0.982965">
</testcase>
<testcase classname="fastlane.lanes" name="04: ensure_git_branch" time="0.011">
<testcase classname="fastlane.lanes" name="04: ensure_git_branch" time="0.013392">
</testcase>
<testcase classname="fastlane.lanes" name="05: pod_install" time="22.712397">
<testcase classname="fastlane.lanes" name="05: pod_install" time="4.078955">
</testcase>
<testcase classname="fastlane.lanes" name="06: pod_lib_lint" time="31.332885">
<testcase classname="fastlane.lanes" name="06: pod_lib_lint" time="9.499866">
</testcase>
<testcase classname="fastlane.lanes" name="07: version_bump_podspec" time="0.00276">
<testcase classname="fastlane.lanes" name="07: version_bump_podspec" time="0.002847">
</testcase>
<testcase classname="fastlane.lanes" name="08: git_commit_all" time="0.107871">
<testcase classname="fastlane.lanes" name="08: git_commit_all" time="0.27811">
</testcase>
<testcase classname="fastlane.lanes" name="09: add_git_tag" time="0.017011">
<testcase classname="fastlane.lanes" name="09: add_git_tag" time="0.016519">
</testcase>
<testcase classname="fastlane.lanes" name="10: push_to_git_remote" time="2.787409">
<testcase classname="fastlane.lanes" name="10: push_to_git_remote" time="1.201634">
</testcase>
<testcase classname="fastlane.lanes" name="11: pod_push" time="10.396381">
<testcase classname="fastlane.lanes" name="11: pod_push" time="8.170025">
</testcase>
<testcase classname="fastlane.lanes" name="12: pod_repo_update" time="9.979275">
<testcase classname="fastlane.lanes" name="12: pod_repo_update" time="4.09159">
</testcase>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment