如何下载文件并将其存储在本地?我搜索了文档和谷歌,找不到它的例子。
我试过这个:
this.copyRemote = function(path,path2){
reader = Ti.Network.createHTTPClient();
writer = Ti.Filesystem.getFile(path2);
reader.open('GET',path);
reader.receive(writer);
}
但是 Tidesdk 在尝试下载文件时崩溃,控制台上的最后一条消息是:
[12:42:39:647] [Ti.Network.HTTPClient] [Debug] Changing readyState from 0 to 1 for url:https://buttonpublish.com/api/images/7/image257189x142.jpg
[12:42:39:671] [Ti.Proxy] [Debug] Looking up proxy information for: https://buttonpublish.com/api/images/7/image257189x142.jpg
[12: