从电子邮件导入 sqlite 数据库?
我已经让我的应用程序调用,从电子邮件导入我的数据所需的功能,但我不确定下一步。该应用程序传递了一个网址,但我不确定如何将该网址下载到我的应用程序文档目录中。我正在尝试下载 a.sqlite 文件。谢谢。
编辑:好的,基本上我无法将我的 data.sqlite 文件从我的电子邮件帐户返回到我的应用程序中。目前,我可以选择使用我的应用程序打开,这样就可以了,我可以看到文件的 URL,但我不确定如何将文件从该 URL 获取到我的应用程序的文档文件夹中,以便我可以用它做一些事情。我一直在尝试使用
NSString *Newpath = [[NSString alloc] initWithFormat:@"%@/new.sqlite",documentPath];
NSData *backup = [NSData dataWithContentsOfURL:url];
[backup writeToFile:Newpath atomically:YES];
where url 是作为运行时传入的 url。希望这能澄清一点。感谢您提供的任何帮助。
I have got my app to call, the required functions to import my data back in from an email, but I am not sure of the next step. The app gets passed a url but i am un sure as to how i actually going to download that URL into my apps document directory. I am trying to download a.sqlite file. Thank you.
EDIT:Ok, basicly i am having trouble getting my data.sqlite file from my email account back into my app. At the moment, i can select open with my app and that works, i can see the URL of the file but i am unsure how i get the file from that URL into the documents folder of my app so i can do something with it. i have been trying to use
NSString *Newpath = [[NSString alloc] initWithFormat:@"%@/new.sqlite",documentPath];
NSData *backup = [NSData dataWithContentsOfURL:url];
[backup writeToFile:Newpath atomically:YES];
where url is the url passed in as run time. Hope that clears thins up a bit. Thanks for any help you can offer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我现在感觉很愚蠢,过去一个小时我一直工作正常,但一直在我的 mac 上查找错误的目录,所以我看不到正在创建的新文件。对于遇到这个问题的其他人,我解决了这个问题,
很抱歉浪费了大家的时间
Ok, i feal stupid now, i have had this working fine for the last hour but have been looking in the wrong directory on my mac so i couldnt see the new files being created. To anyone else with this issue, i solved it with this
sorry for wasting everyones time