-(IBAction)goback:(id)sender
{
NSURL *xmlURL=[NSURL URLWithString:@"http://demo.komexa.com/sicherungsbereich.xml"];
NSURLRequest *request = [NSURLRequest requestWithURL:xmlURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:2];
NSURLResponse *theResponse;
NSError *theError;
NSData *myRequestResult = [NSURLConnection sendSynchronousRequest:request returningResponse:&theResponse error:&theError];
NSString *stringReply = (NSString *)[[NSString alloc] initWithData:myRequestResult encoding:NSUTF8StringEncoding];
NSLog(@"reply from server: %@", stringReply);
}
전화
, 그것은, 문자열을 캐시 그래서 경우에도 http://demo.komexa.com/sicherungsbereich.xml의 내용 변경 (당신은 http://demo.komexa.com를 호출하여 그렇게 할 수 있습니다) 문자열은 자동으로 새 데이터를 다시로드하지 않습니다.
아이디어가 있으십니까? 나는 때문에 형식의 문제, 여기에 코드를 업로드 한
는 : http://demo.komexa.com/problem.txt
- (IBAction를)하고 GoBack (ID) 송신기 { NSURL xmlURL * = [NSURL URLWithString @ "http://demo.komexa.com/sicherungsbereich.xml"]; NSURLRequest * 요청 = [NSURLRequest requestWithURL : xmlURL cachePolicy : NSURLRequestReloadIgnoringCacheData timeoutInterval : 2]; NSURLResponse * theResponse; NSError * theError; NSData * myRequestResult = [NSURLConnection sendSynchronousRequest : requestResponse 요청 : & theResponse 오류 : & theError]; NSString * stringReply = (NSString *) [[NSString alloc] initWithData : myRequestResult 인코딩 : NSUTF8StringEncoding]; NSLog (@ "reply from server : % @", stringReply); } – Ploetzeneder
코드 서식을 지정하려면 코드 블록을 선택하고 1과 0이있는 단추를 누르거나 각 코드 줄 앞에 4 칸을 둡니다. –
오케이, 고마워. 다른 사람이 이것을 어떻게 얻을 수있는 아이디어가 있습니까? – Ploetzeneder