13 Replies Latest reply on Mar 21, 2016 1:57 PM by sfpx

    [IOS] Database corruption

    sfpx

      It may be related to the sdk only but I would guess that it happens with FMGO too.

       

      I'm testing different approaches to download data and made a simple script that imports records from an hosted database.

       

      I tested what would happen if the user would lose internet access.

      A message appears giving the choice between "Retry" and "Close All"

      If I choose "Close All", the database gets damaged every single time.

      That is quite brutal and makes the use of the import function pretty useless .

       

      The script is pretty much only the Import Function.

       

      Any idea on this ?

       

      P.S.

      The database is a test one with only 2 tables , 2 layouts and 1 script.

      It's about 300Kb.

        • 1. Re: [IOS] Database corruption
          sfpx

          I tested it on Filemaker GO and the file (on the device) gets damaged too.

          If anyone is willing to test this, that would be really appreciated.

          • 2. Re: [IOS] Database corruption
            schamblee

            I will test.  Close file is one of the steps used In the update process.  I have also use it and I don't get a corrupt file.  I'm sure there is something else causing your issue.  Place a test copy up for download or send me a download link and I will test.

            • 3. Re: [IOS] Database corruption
              Markus Schneider

              does the db get damaged (no way to open it again in FM) - or is just FMGo telling You that the file is damaged after opening it?

               

              I have had that too, but none of my tools reported any error (FMVis, FMDiff, ). That seemes to be an issue with FMGo when one of its files is no longer available

              • 4. Re: [IOS] Database corruption
                sfpx

                I transferred the file to my computer and Filemaker Pro Advanced reported the damage too.

                 

                So you confirm that it happens to you too Markus?

                If so, it's quite an important bug to fix.

                If anyone has a workaround...

                • 5. Re: [IOS] Database corruption
                  sfpx

                  One interesting discovery.

                  I can avoid corruption by clicking the home button before trying the import.

                   

                  Here are my 2 tests

                   

                  Test A

                  1.Delete the database from the device with Itunes

                  2.Launch the app so it does dot try to load an hibernated copy

                  3.Transfer the database to the device using Itunes

                  4.Launch the app (or load the db with fmgo)

                  5.Run the import function

                  6.Turn of wifi on the device

                  7.Choose "Close All"

                  8.File is damaged

                   

                  Test B

                  1.Delete the database from the device with Itunes

                  2.Launch the app so it does dot try to load an hibernated copy

                  3.Transfer the database to the device using Itunes

                  4.Launch the app (or load the db with fmgo)

                  5.Click the Home Button of the Iphone

                  6.Relaunch the app (or reload the dn using fmgo)

                  7.Turn of wifi on the device

                  8.Choose "Close All"

                  9.File is NOT DAMAGED

                  • 6. Re: [IOS] Database corruption
                    sfpx

                    Forgot a step in both tests.

                    Between 2 and 3. End the fmgo or the app task on the device.

                    • 7. Re: [IOS] Database corruption
                      sfpx

                      Also forgot a step on test B between 6 and 7: Run the import script

                       

                      P.S.

                      Am I the only one who can not edit his posts ? The action button no longer works and it's starting to frustrate me a lot.

                      • 8. Re: [IOS] Database corruption
                        beverly

                        are you trying to edit from Activity or Inbox? if so, click on the title for the topic to see all of the thread and see if you can edit from there.

                        beverly

                        • 9. Re: [IOS] Database corruption
                          sfpx

                          I'm trying to use the Actions button from the thread view (I see the whole thread).

                          It works for you ?

                          I tried with Safari, Chrom and Firefox on my Mac.

                          • 10. Re: [IOS] Database corruption
                            sfpx

                            Oh so here's my workaround for now.

                            It's pretty ugly but seems to work on my FIAS app.

                            In the OnFirstWindowOpen script I added

                             

                            Go To Layout ["Settings"]

                            If [IsEmpty (Settings::FirstRun)]

                                 Set Field [Settings::FirstRun;1]

                                 Exit Application

                            End If

                             

                            With a FIAS app, "Exit application" will relaunch the file .

                             

                            Now if I turn off wifi during the import and use the Close All option, the file does not get damaged.

                             

                            Could it be related to the file hibernation ???

                            • 11. Re: [IOS] Database corruption
                              Markus Schneider

                              I have a different environment - I'm on FMGo, my FIAS apps do not import. I've had it a couple of times when I left my office (WIFI..) and wanted to work again on a local file on train. A non-dependent other file was open when I left the office, causing FMGo to close all files.

                              when restarting the local app, a message appeared telling me the the file is damaged - but opening again didn't show any messages...

                              • 12. Re: [IOS] Database corruption
                                sfpx

                                Here is the full way to replicate the problem and the solution for an FIAS app.

                                It may be a bit long to test but I think it's quite an important issue.

                                 

                                The Database

                                1.Create a table "Settings" with one Number Field named "FirstRun"

                                2.Create a table "Data" with a few fields that will be used by the import function

                                3.Create a script that imports records from an hosted database into the Data table (chose a an hosted table with a lot of data so you will have the time to interrupt the import before it finishes.

                                4.Create a record in the Settings table but do not enter anything in the FirstRun field

                                5.Set the file options to switch to the Settings layout on startup.

                                6.Create a button on the settings layout that execute the Import script

                                 

                                The damage

                                1.Create a new FIAS project

                                2.Drag and drop the database into the Xcode project and set the launchfile in configfile.txt accordingly

                                3.Compile the app and test it on your device

                                4.Click the import button

                                5.Once the process has started, turn off your wifi or cellular internet access

                                6.Wait for the error message and choose "Close All"

                                7.Database should be damaged.

                                 

                                 

                                The solution ?

                                1.Uninstall the app from your device (important).

                                2.Using Filemaker Pro. File Options/Script Triggers/OnFirstWindowOpen add this script

                                Go To Layout ["Settings"]

                                If [IsEmpty (Settings::FirstRun)]

                                     Set Field [Settings::FirstRun;1]

                                     Exit Application

                                End If

                                3.Delete the file from the Xcode project and insert the new file

                                4.Enable internet access on your device

                                5.Recompile the app, install it on your device and retest like before

                                5.Database should not get damaged.

                                 

                                 

                                Basically, It seems that if the file has been hibernated it will not get damaged.

                                • 13. Re: [IOS] Database corruption
                                  sfpx

                                  Well, hold on.

                                  I can't even reproduce the file corruption with those steps myself today.

                                  Just forget it. I guess I have more tests to do to figure it out.