Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Text 如何将文本字段中的数据从LiveCode保存到iOS和Android上的文件中?_Text_Livecode - Fatal编程技术网

Text 如何将文本字段中的数据从LiveCode保存到iOS和Android上的文件中?

Text 如何将文本字段中的数据从LiveCode保存到iOS和Android上的文件中?,text,livecode,Text,Livecode,我的LiveCode堆栈中有各种文本字段,我正试图将它们保存到我的移动设备中。我试过各种方法,但到目前为止似乎都不管用。我试图从按钮使用的主脚本是- on mouseUp put field "name" into ("file:"&specialFolderPath("engine")&"/name.txt") end mouseUp 这似乎不像我尝试使用dome调试一样有效- on mouseUp answer there is a file ("file:"&a

我的LiveCode堆栈中有各种文本字段,我正试图将它们保存到我的移动设备中。我试过各种方法,但到目前为止似乎都不管用。我试图从按钮使用的主脚本是-

on mouseUp
  put field "name" into ("file:"&specialFolderPath("engine")&"/name.txt")
end mouseUp
这似乎不像我尝试使用dome调试一样有效-

 on mouseUp
  answer there is a file ("file:"&specialFolderPath("engine")&"/name.txt")
 end mouseUp

它总是返回false。你能给我一些指点一下我在上面的脚本中遗漏了什么吗。谢谢。

您无法在移动设备上写入引擎文件夹。您应该改用“文档”文件夹:

on mouseUp
  put field "name" into URL ("file:" & specialFolderPath("documents") & "/name.txt")
end mouseUp

如果文件只是临时文件且不需要备份,您也可以写入
specialFolderPath(“缓存”)
。iOS还提供了
specialFolderPath(“临时”)
选项。

Devin和Mark都是正确的。引擎文件夹在移动设备上不是可写位置,因此,您需要选择其他可写位置(例如“文档”)

但是,更改路径不会完全解决此问题,因为脚本中缺少URL关键字。如果缺少此文件,则不会创建任何文件,并且会返回编译错误

完整正确的工作脚本如下所示-

put field "name" into url ("file:" & specialFolderPath("documents") & "/name.txt")

不要使用“引擎”。用“文档”代替。谢谢你抓住我的错误,尼尔。更正了我原始答案中的示例。