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. Block的用法

    定义block 无参数无返回值的block 定义格式: void (^block)() = ^{ NSLog(@"block"); }; 有参有返回值的block 定义格式 int ...

  2. C语言编译过程

    GCC编译C源码有四个步骤: 预处理-----> 编译 ----> 汇编 ----> 链接 一. 编译和链接的流程 C语言的编译链接过程要把我们编写的一个c程序(源代码)转换成可以在 ...

  3. dp --- hdu 4939 : Stupid Tower Defense

    Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/ ...

  4. Open Audio Library

    Open Audio Library OPENAL是一个音效API,负责系统和声卡之间的沟通,几乎没有一个API能达到她的全部潜能.由 Creative公司.nvidia公司 和 Loki工作室 发起 ...

  5. JS弹出框插件zDialog再次封装

    zDialog插件网址:http://www.jq22.com/jquery-info2426 再次封装zDialog的代码: (function ($) { $.extend({ iDialog: ...

  6. C# 重载的几种实现

    算法重用是非常普遍的需求,在C#中可以使用如下手段实现,非常简单,自己记录一下,方便查询. 以一个小功能为例来说明一下:打印1-5这5个数,和A-E这5个字符. 重载方式 static void Ma ...

  7. 把VIM打造成IDE

    =======================================                                    安装vim相关软件 =============== ...

  8. nested exception is org.hibernate.QueryException: could not resolve property

    SSH框架出现了下面的错误: nested exception is org.hibernate.QueryException: could not resolve property 检查了hbm.x ...

  9. 基于TCP和多线程实现无线鼠标键盘-Socket(2)

    在(1)中,实现了Windows服务端与Android客户端的连接,本节将实现在Windows服务端与Android客户端之间传递数据. Android客户端的发送线程SendThread.java代 ...

  10. linux信任公钥的配置

    一.每个用户都有自己的家目录 访问方式是:~/.ssh/id_rsa.pub 使用~就是表示家目录. 具体家目录在哪里,在用户密码配置文件中:/etc/passwd中.第6列的值就是. 可以使用~访问 ...