我的LiveCode堆栈中有各种文本字段,我正在尝试保存到我的移动设备中。我尝试了各种方法,但到目前为止似乎都没有。我尝试使用按钮的主要脚本是 -
on mouseUp
put field "name" into ("file:"&specialFolderPath("engine")&"/name.txt")
end mouseUp
这似乎并不像我尝试使用 -
进行圆顶调试一样 on mouseUp
answer there is a file ("file:"&specialFolderPath("engine")&"/name.txt")
end mouseUp
它总是返回false。你能不能给我一些指点,说明我在上面的脚本中遗漏了什么。感谢。
答案 0 :(得分:1)
您无法写入移动设备上的引擎文件夹。您应该使用文档文件夹:
on mouseUp
put field "name" into URL ("file:" & specialFolderPath("documents") & "/name.txt")
end mouseUp
如果文件只是临时文件而您不需要备份文件,也可以写信给specialFolderPath("cache")
。 iOS还为您提供specialFolderPath("temporary")
选项。
答案 1 :(得分:1)
德文和马克都是对的。引擎文件夹在移动设备上不是可写的位置,因此,您需要选择一个可替换的可写位置(例如" Documents")
但是,更改路径无法完全解决此问题,因为脚本中缺少URL关键字。如果缺少这个,将不会创建任何文件,并且将返回编译错误。
完整正确的工作脚本就像 -
put field "name" into url ("file:" & specialFolderPath("documents") & "/name.txt")