1
TBXML을 사용하여 웹에서 .xml 파일을 다운로드합니다. 파일을 올바르게 구문 분석하고 원하는 모든 데이터를 가져옵니다.TBXML이 파일을 업데이트하지 않습니다.
내 문제는 내가 서버에서 파일을 업데이트하고 응용 프로그램에서 업데이트하지 않았다는 것입니다. 앱을 삭제하고 다시 설치할 때만 파일을 업데이트했습니다.
캐시 같은 것이 있습니까?
이 내가 주문하는 방법입니다 페치 :
-(void)getXML {
NSLog(@"Updating ATC data !");
// Create a success block to be called when the async request completes
TBXMLSuccessBlock successBlock = ^(TBXML *tbxmlDocument) {
// If TBXML found a root node, process element and iterate all children
if (tbxmlDocument.rootXMLElement)
[self traverseElement:tbxmlDocument.rootXMLElement];
};
// Create a failure block that gets called if something goes wrong
TBXMLFailureBlock failureBlock = ^(TBXML *tbxmlDocument, NSError * error) {
NSLog(@"Error! %@ %@", [error localizedDescription], [error userInfo]);
};
// Initialize TBXML with the URL of an XML doc. TBXML asynchronously loads and parses the file.
TBXML *tbxml = [[TBXML alloc] initWithURL: [NSURL URLWithString:@"http://www.mysite.com/myFile.xml"]
success: successBlock
failure: failureBlock];
}
을 그리고 이것은 내가 백그라운드에서 호출하는 방법입니다
[self performSelectorInBackground:@selector(getXML) withObject:Nil];
TBXML는 비동기 적으로 작동하기 때문에 배경에 전화를 쓸모있을 수 있습니다, 누군가가 내가 그것을 빼앗을 것을 확인할 수 있다면. 또한 파일이 올바르게 구문 분석되기 때문에 내 traverseElement:
메서드의 코드가 유용하다고 생각하지 않습니다.
도움을 주셔서 감사합니다.
안녕하세요, 동일한 문제가있어이 문제를 해결하는 방법을 알려주세요. 오래된 캐시 된 XML 파일을로드하고 서버에서 새로운 파일을 보지 않습니다! 새 앱을 만들려면 앱을 삭제해야합니다. : ( – GameDev
미안하지만, 내 대답은 말하기를, 나는이 문제를 해결 한 것이 무엇인지 모르겠다. .. – rdurand
OK 좋아, 다른 사람들이 실제로 이것이 일어날 수있는 원인을 알고 있니? – GameDev