5 Replies Latest reply on Oct 15, 2013 4:46 AM by Mike_Mitchell

    Strange error: "File already open" on iOS?


      Good day. I'm working on an app that pulls in the previous version's data using a connector file, similar to a sync protocol. This is working fine on the desktop and on my iPad, running iOS 7. However, on my wife's iPod, running iOS 6, I'm getting a very strange error: "The file [filename] could not be opened because it is already open." The code in question is trying to run a script in the file being called out.


      I've triple-checked all the file references, and they're all of the form "file:filename". The databases are all in the same location. And, as I said, this works fine on iOS 7. Very strange.


      Has anybody seen behavior like this? Any clues as to why this might be happening? It stops the script and brings up the file browser on Go, which is, of course, completely unacceptable in the middle of an update routine.





        • 1. Re: Strange error: "File already open" on iOS?

          Mike, in your script do you have a close file step that you are run and then are you using an open file step.  In my experience I find that using a close window step (for the file you want to close) works better than a close file step.  The close window step works all of the time but some times the close file step doesn't seem to work.

          • 2. Re: Strange error: "File already open" on iOS?

            That's a good tip, but no. The error seems to be occurring (can't say for sure; no debugger) on a "Perform Script" step. That step is attempting to execute a script in an external file. The file in question is already open.


            A bit more detail: The process looks something like this:


            1) Initiate update from new version.

            2) Deploy connector file using Export Field Contents and Get ( DocumentsPath ).

            3) Connector file opens old file. (Doesn't need to open new file; it's already open.)

            4) Connector file starts a loop over tables included in the update. With each iteration, it executes a script in the new file to delete all the data in that specific table. (This is where things go wonky.)

            5) Connector file uses "processing in place" to move data from table occurrences in old file to matching TOs in new file.

            6) Connector file closes old file. (It does this by executing a remote script in the old file. Like yourself, I found an explicit "Close File" script step unreliable.) Leaves new file & itself open for messaging / logging purposes.


            What I don't get is why step 4 is blowing up, but only on my wife's iPod. Works fine on my iPad and on the desktop.

            • 3. Re: Strange error: "File already open" on iOS?

              Mike, a while back I had a similar issue and I can't remember exactly what I did but I think it might have been something like this.  Have the connector file close the new file with the close window step, then have the connector file reopen the new file in step 3.  When calling external scripts FM GO seems to get a little lost sometimes with file management.

              1 of 1 people found this helpful
              • 4. Re: Strange error: "File already open" on iOS?

                Okay, thanks. I'll give that a try.

                • 5. Re: Strange error: "File already open" on iOS?

                  Well, color my face red ...


                  My wife's iPod didn't have the latest version of FM Go. Upgrading solved the issue.


                  Does bring up an interesting note, though. Apparently, the issue with executing external scripts was a bug, corrected in the latest release. Just FYI.


                  Thanks for the help.