首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TBXML不更新文件

TBXML不更新文件
EN

Stack Overflow用户
提问于 2012-09-20 18:36:20
回答 1查看 265关注 0票数 1

我使用TBXML从web上下载了一个.xml文件。我正确地解析了文件,并获得了我想要的所有数据。

我的问题是我在服务器上更新了文件,但它没有在应用程序中更新。它只在我删除并重新安装应用程序时更新文件。

有没有什么缓存之类的东西?

下面是我对fetch的排序方式:

代码语言:javascript
复制
-(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];

}

这就是我在后台调用它的方式:

代码语言:javascript
复制
[self performSelectorInBackground:@selector(getXML) withObject:Nil];

在后台调用它可能是无用的,因为TBXML是异步工作的,如果有人能确认我会把它拿走的话。另外,我不认为我的traverseElement:方法的代码在这里有用,因为文件被正确地解析了。

感谢你在这里的帮助!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-20 23:38:21

这个问题似乎消失了..它工作得很好,但我不知道为什么它一开始就不能工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12510868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档