Toplam 48 Görüntülenme
Uygulamadan sunucumuzdaki bir php dosyasına veri göndermek için aşağıdaki kodu kullanabiliriz.
Örneğimizde cihazla ilgili bazı bilgileri gönderiyoruz.
#import "UIDeviceHardware.h"
- (void) postDataRequest {
NSString *urlstr = [[NSString alloc] initWithFormat:@"http://www.sulubeyn.com./data.php?name=%@&sysver=%@&uuid=%@&v=1.0",
[[UIDevice currentDevice] name],
[[UIDevice currentDevice] systemVersion],
[[UIDevice currentDevice] uniqueIdentifier]
];
NSString *urlstrEscape = [urlstr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:urlstrEscape]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:3.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest
delegate:self];
NSLog(@"%@", theConnection);
}
