NSString * appKey = @"57105bbbe0f55a7938002063";
NSString * deviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString * mac = [self macString];
NSString * idfa = [self idfaString];
NSString * idfv = [self idfvString];
NSString * urlString = [NSString stringWithFormat:@"http://log.umtrack.com/ping/%@/?devicename=%@&mac=%@&idfa=%@&idfv=%@", appKey, deviceName, mac, idfa, idfv];
[NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:urlString]] delegate:nil];

  

#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_dl.h> //for idfa
#import <AdSupport/AdSupport.h> - (NSString * )macString{
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");
free(buf);
return NULL;
} ifm = (struct if_msghdr *)buf;
sdl = (struct sockaddr_dl *)(ifm + 1);
ptr = (unsigned char *)LLADDR(sdl);
NSString *macString = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X",
*ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)];
free(buf); return macString;
} - (NSString *)idfaString { NSBundle *adSupportBundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/AdSupport.framework"];
[adSupportBundle load]; if (adSupportBundle == nil) {
return @"";
}
else{ Class asIdentifierMClass = NSClassFromString(@"ASIdentifierManager"); if(asIdentifierMClass == nil){
return @"";
}
else{ //for no arc
//ASIdentifierManager *asIM = [[[asIdentifierMClass alloc] init] autorelease];
//for arc
ASIdentifierManager *asIM = [[asIdentifierMClass alloc] init]; if (asIM == nil) {
return @"";
}
else{ if(asIM.advertisingTrackingEnabled){
return [asIM.advertisingIdentifier UUIDString];
}
else{
return [asIM.advertisingIdentifier UUIDString];
}
}
}
}
} - (NSString *)idfvString
{
if([[UIDevice currentDevice] respondsToSelector:@selector( identifierForVendor)]) {
return [[UIDevice currentDevice].identifierForVendor UUIDString];
} return @"";
}

  

umeng track 相关的更多相关文章

  1. 多媒体文件格式之MKV

    [时间:2016-07] [状态:Open] MKV是一种开源的多媒体封装格式,是Matroska中应用比较多的格式之一.常见的后缀格式是.mkv(视频,包括音频和字幕)..mka(纯音频)..mks ...

  2. MP4 ISO基础媒体文件格式 摘要 1

    目录 Object-structured File Organization 1 File Type Box (ftyp) Box Structures File Structure and gene ...

  3. P & R 8

    Floorplan: 要做好floorplan需要掌握哪些知识跟技能? 通常,遇到floorplan问题,大致的debug步骤跟方法有哪些? 如何衡量floorplan的QA? T:Block lev ...

  4. 嵌入式单片机STM32应用技术(课本)

    目录SAIU R20 1 6 第1页第1 章. 初识STM32..................................................................... ...

  5. SQL数据同步到ELK(四)- 利用SQL SERVER Track Data相关功能同步数据(上)

    一.相关文档 老规矩,为了避免我的解释误导大家,请大家务必通过官网了解一波SQL SERVER的相关功能. 文档地址: 整体介绍文档:https://docs.microsoft.com/en-us/ ...

  6. 解密FFmpeg播放track mode控制

    上一篇文章(http://www.cnblogs.com/yangdanny/p/4421130.html)我们解决了在FFmpeg下如何处理H264和AAC的扩展数据,根据解出的NALU长度恢复了H ...

  7. 腾讯bugly 的crash 上报和umeng的比较

    说到crash上传工具,大家肯定会第一时间想到umeng,不错,umeng 是最早推出 crash 上报的工具之一,在刚推出来的时候,特别受到ios开发人员的喜爱. 因为个时候,内存是手动管理的,很容 ...

  8. Linux 相关基础笔记

    html,body { } .CodeMirror { height: auto } .CodeMirror-scroll { } .CodeMirror-lines { padding: 4px 0 ...

  9. linux 相关学习记录

    (一)概念① 物理CPU实际Server中插槽上的CPU个数物理cpu数量,可以数不重复的 physical id 有几个② 逻辑CPU /proc/cpuinfo 用来存储cpu硬件信息的信息内容分 ...

随机推荐

  1. MyBaits学习

    一:配置MyBaits的开发环境 1.1.核心配置文件 正如hibernate一样,MyBaits也有一个核心的配置文件,它包含着数据源地址,用户名,密码等,还有着各个实体类的配置文件,配置文件是xm ...

  2. Windows Azure Affinity Groups (3) 修改虚拟网络地缘组(Affinity Group)的配置

    <Windows Azure Platform 系列文章目录> 本文介绍的是国内使用世纪互联运维的Azure China 在笔者之前的文章中,我们知道现在微软官方不建议使用Affinity ...

  3. 第4/24周 页面限制8060 bytes

    恭喜您!在你面前就只剩下几页了,然后你就可以完成第1个月的SQL Server性能调优培训了.今天我将讲下页的一些限制,还有为什么你会喜欢这些限制,同时也会讨厌这些限制. 正如你在第2周学到的,数据页 ...

  4. ClojureScript魔法堂:搭建开发环境

    一.前言 当看到Lisp等函数式编程语言的语法是 (say (concat "hello" "world")) 这样的时候,我就有种深入学习的冲动,因为它的语法 ...

  5. Ajax 学习 - 基础学习

    <AJax - Async Javascript and xml - 异步的JavaScript和XML> 一.基础认识 AJax技术的目的:实现页面无刷新数据动态更改 优点:  + 不需 ...

  6. onblur鼠标失去焦点事件

  7. php中的常用数组函数(八) 排序函数汇总(sort、rsort、usort、asort、uasort、arsort、ksort、uksort、krsort、natsort、natcasesort、array_multisort)

    测试环境:php5.3.29 sort_flags 可以用以下值改变排序的行为: 排序类型标记: SORT_REGULAR - 正常比较单元(不改变类型) SORT_NUMERIC - 单元被作为数字 ...

  8. MYSQL 练习

    导出现有数据库数据: mysqldump -u用户名 -p密码 数据库名称 >导出文件路径           # 结构+数据 mysqldump -u用户名 -p密码 -d 数据库名称 > ...

  9. CentOS6.5下安装PostgreSQL

    一.配置 YUM 仓库 修改原始的 yum 仓库配置: vim /etc/yum.repos.d/CentOS-Base.repo 在[base]和[updates] 节(section)部分的尾部插 ...

  10. jQuery Mobile页面返回无需重新get

    最近公司的web app项目,使得我有幸一直接触和学习jQuery Mobile.这确实是一个很不错的移动开发库,有助于擅长web开发的工程师,快速入门并构建自己的移动应用.但是在前两天,我碰到了一个 ...