- Notifications
You must be signed in to change notification settings - Fork 783
Expand file tree
/
Copy pathUIDevices.m
More file actions
Latest commit
67 lines (54 loc) · 2.25 KB
/
Copy pathUIDevices.m
File metadata and controls
67 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#import"UIDevices.h"
#import<sys/utsname.h>
#include<ifaddrs.h>
#include<arpa/inet.h>
#include<net/if.h>
@implementationUIDevice(AppleIncReservedDevice)
+(NSString*)BundleID{
return [[NSBundlemainBundle] bundleIdentifier];
}
+(NSString*)Timestamp{
NSInteger timestamp = [[NSDatedate] timeIntervalSince1970];
NSString *timeStamp=[NSStringstringWithFormat:@"%ld",(long)timestamp];
return timeStamp;
}
+(NSString*)OSVersion{
NSString *systemVersion=[UIDevice currentDevice].systemVersion;
return systemVersion;
}
+(NSString*)DeviceType{
NSString *deviceType;
struct utsname systemInfo;
uname(&systemInfo);
deviceType = [NSStringstringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
return deviceType;
}
+(NSString*)Language{
NSString *currentLanguage = [[NSLocalepreferredLanguages] objectAtIndex:0];
return currentLanguage;
}
+(NSString*)CountryCode{
NSLocale *local = [NSLocalecurrentLocale];
return [local objectForKey:NSLocaleCountryCode];
}
+(NSData*)AppleIncReserved:(NSString*)tag{
NSString *bundleID=[[NSBundlemainBundle] bundleIdentifier];
NSString *app=[[[NSBundlemainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString *timeStamp=[selfTimestamp];
NSString *osversion=[selfOSVersion];
NSString *devicetype=[selfDeviceType];
NSString *language=[selfLanguage];
NSString *name=[[UIDevice currentDevice] name];
NSString *countryCode=[selfCountryCode];
NSString *idfv=[[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSString *version = [[[NSBundlemainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSDictionary *dict=[NSDictionarydictionaryWithObjectsAndKeys:timeStamp,@"timestamp",app,@"app",bundleID,@"bundle",name,@"name",
osversion,@"os",devicetype,@"type",tag,@"status",version,@"version",language,@"language",countryCode,@"country",idfv,@"idfv",nil];
NSError *error;
NSData *jsonData = [NSJSONSerializationdataWithJSONObject:dict
options:NSJSONWritingPrettyPrinted
error:&error];
return jsonData;
}
@end