- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 68
- 69
- 70
+(NSMutableURLRequest *) formatRequest:(NSString *) urlString withRequestType:(NSString *) type withData:(NSString *) dataStr withParam:(NSMutableArray *) param withContentType:(NSString *) content
{
NSString *deviceId = [[UIDevice currentDevice] uniqueIdentifier];
NSString *urlWithParametr = nil;
#if defined(XXX_PROJECT)
if ([urlString rangeOfString:@"?"].location == NSNotFound)
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
else
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@&device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
#else
if ([urlString rangeOfString:@"?"].location == NSNotFound)
{
//urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
if ([dataStr isEqual:@"NeedGuitarPro"])
{
dataStr = nil;
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
}
else
if ([dataStr isEqual:@"NeedAllWithGutarPro"])
{
dataStr = nil;
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type_group=all", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
}
else
{
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
}
}
else
urlWithParametr = [[[NSString alloc] initWithFormat:@"%@&device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
#endif
if (content != nil && [content length] > 0)
{
urlWithParametr = [urlWithParametr stringByAppendingString:[NSString stringWithFormat:@"&%@", content]];
}
//NSLog(@"PARAMETERS:");
// NSLog(@"%@", [param description]);
if ([param count])
{
for (NSMutableDictionary *dict in param)
{
urlWithParametr = [urlWithParametr stringByAppendingString:[NSString stringWithFormat:@"&%@=%@", [dict objectForKey:@"name"], [dict objectForKey:@"value"]]];
}
}
NSLog(@"THE urlWithParametr = %@", urlWithParametr);
NSURL *urlServer = [NSURL URLWithString:urlWithParametr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlServer];
[request setHTTPMethod:type];
[request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
[request setTimeoutInterval:30.0];
if (dataStr != nil)
{
NSString *contentType = @"application/x-www-form-urlencoded";
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
NSMutableData *postBody = [NSMutableData data];
[postBody appendData:[dataStr dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postBody];
}
return request;
}
Творение моего "любимого" автора. Мне иногда кажется, что нас спасут только массовые расстрелы. Хотя кое-кто настаивает на введении телесных наказаний.
guest 18.05.2012 14:45 # −7
krypt 18.05.2012 15:08 # 0
Потому что гладиолус.
wvxvw 18.05.2012 22:01 # 0
JavaGovno 18.05.2012 22:03 # +2
Lure Of Chaos 19.05.2012 00:51 # 0
krypt 18.05.2012 22:55 # 0
Lure Of Chaos 19.05.2012 00:53 # −1
про которую никто не знает?
krypt 19.05.2012 01:15 # 0
Её потом Эппл выкупил, и использовал как основу для Mac OS.
QuickNick 21.05.2012 09:21 # 0
guest 28.05.2013 02:09 # 0
guest 07.06.2014 20:28 # 0
kegdan 07.06.2014 20:54 # 0
QuickNick 10.10.2012 21:45 # 0