14 Replies Latest reply on Mar 6, 2016 2:08 PM by almute

    iOS App problem with script trigger on first window

    almute

      Hello,

       

      I'm testing for my first  iOS App and found that the script trigger which is executed when opening the first window is not executed automatically. In FMGO and on PC is works.

       

      Did anyone discover this problem too?

      What could be a solution? I don't want to let the user manually execute this script.

       

      Best,

      Almute

        • 1. Re: iOS App problem with script trigger on first window
          schamblee

          The script trigger fires on First Window open.   The Document area works different in iosAppSDK than it does in FMGo.   When you close a app in FMGo it closes the database and goes to the document area and list the databases.  If you close a database in iosAppSDK it closes the database then reopens the databases and the onFirstWindow Script trigger fires.   If you double click the home button then swipe up the database will close but resumes where the user left and the onFirstWindow Script trigger does not fire.    The issue really is about how iosApp closes or should I say doesn't close.   I read somewhere that the lack of a close button is an Apple thing, so I don't know if FMI will ever add a close button that closes the database and the iosAPP, which is what is needed. 

           

          You make a feature request / Product idea Product Ideas

          • 2. Re: iOS App problem with script trigger on first window
            almute

            Thank, I understand.

             

            So, does anyone has a suggestion what to do, to have a script executed in any case when the user "starts" the app?

             

            In my case the app contains a couple of databases and one main database (called the Manager) is used to open the individual databases (all only on iPad) and to switch between the databases. The start script of the Manager does a few preparations. For example it checks if there had been loaded updater files for the databases (in case of an update provided in store) and if possible it does an update to the databases.

             

            Best, Almute

            • 3. Re: iOS App problem with script trigger on first window
              schamblee

              This is version 1 so everyone is still learning and hopefully FMI will make some updates in the near future.

              The iosAppSDK will allow you to have more than database and the config file lets you specify which database is the main.   You might try adding a script trigger on the main layout (layout enter) that checks for additional file in the document path and then if there is additional file then proceed with update.

              For Example :  Note you may have to change the 1 to the number of files that you have in your app.

               

              If [ ValueCount ( Get ( DocumentsPathListing ) ) > 1 ]

              http://www.yzysoft.com/filemaker-tips/how-to-update-native-ios-app-created-with-filemaker-ios-app-sdk/

               

              You can use exit application and or close script steps in your scripts which will force iosAppSDK to restart and open the main databases with the onfirstWindow script. 

              I'm currently working on update process myself, so I still learning too.

              • 4. Re: iOS App problem with script trigger on first window
                almute

                Meanwhile I have found a solution which is working for my app.

                In addition to having triggered when opening the first window the script which is checking for updater files for the databases, I now have triggered it also on a button in the main database which is used by everyone. In my case triggering on "Layout enter" will not working since this ends up in an endless loop.

                 

                I think that using "If [ ValueCount ( Get ( DocumentsPathListing ) ) > x ]" is unsafe because there will be more files in the list then you provided for example when the user has created a PDF.

                When updating the app I will provide new database with special characters in the file names (p.e. ##). Then I can look if there are files in documents path with ## in the name.

                • 5. Re: iOS App problem with script trigger on first window
                  schamblee

                  I think that using "If [ ValueCount ( Get ( DocumentsPathListing ) ) > x ]" is unsafe

                  No, it would not be unsafe, you would just have to add more to the script and or calculation to determine if it is an update file.   You can use get(filename) to get name of the current database.   You could use right xx number of letters to get the filename off the end.  As the link I posted above states, you would want to use filenames such as myfile01 and increase the number each time  you update the file.  So if you have myfile01 as the current file and then detect myfile02 then you know you have a update available.   I have not finish creating / testing my update process but I understand from the other link that the iosappSDK will detect a update automatically and open that file so the current file should myfile02 and then if this file is empty and by script using above method I detect a myfile01 then I would then give the user an option to import the data from myfile01.     

                  • 6. Re: iOS App problem with script trigger on first window
                    almute

                    You are right and what you wrote is nearly what I wanted to say.

                     

                    In my app I will have the special case that the current file needs to have the same name in any version of the app. I can't use myfile01, myfile02 or myfile03 for the current file. In any case the current database file needs to be "myfile". This is because there also exists an app for Mac and Windows where my users can use this files. A data exchange between all this platforms will be provided.

                    • 7. Re: iOS App problem with script trigger on first window
                      schamblee

                      I'm still working on my update system and I will you know how that goes.

                       

                      I would not use the same file that is being used for Mac and Windows.  The ## in the filename is just for the iosAPP, it is the file placed in the solutions folder.

                      iosApp can be setup to connect to a network. 

                       

                      I understand from the RC webinar video that seedcode GoZync will sync iosApps to FM.   I'm sure other sync solution will work too.   Webinar Making FM Apps for Apple's App Store - FileMaker User Group Meeting Fri Jan 15th - YouTube 

                      • 8. Re: iOS App problem with script trigger on first window
                        almute

                        My users can't use a network because they only have a runtime not FileMaker PC. And runtimes don't support network. The solution is a one user software. GoZync will not work. (I had participated at the Webinar.)

                         

                        For my app it is essential to use the same file names I use on PC. The users copy the files using iTunes from iPad to PC and back. The solution is on the market for 5 years and available for iPad since FM Go 1. All scripts which access to other databases in  the package are using the standard file names of this solution. This will make all a little bit more difficult.

                         

                        I'm interested in your progress developing the update function.

                        • 9. Re: iOS App problem with script trigger on first window
                          schamblee

                          The file you are transferring to the ipad is not a runtime.  FMGo or iosAPPSDK is the runtime for ios devices.   The database with fmpur or whatever extension you changed it too will still open in FM.    The user is not going to be able to transfer a database from the iosAPPSDK to the PC.   There are some steps to remove it from the plist file but that would not be suitable for a end user and the end user would not be able to transfer the file back. 

                           

                          It appears to me you need a separate ios and pc program.

                           

                          Good luck.

                          • 10. Re: iOS App problem with script trigger on first window
                            almute

                            The file you are transferring to the ipad is not a runtime.  FMGo or iosAPPSDK is the runtime for ios devices. 

                            Yes, this is obvious

                             

                            The database with fmpur or whatever extension you changed it too will still open in FM.

                             

                            I use the files related to my Mac and Windows runtimes with iosAPPSDK and they still open in the PC runtimes, when transferring back. This is working perfectly.

                            The user is not going to be able to transfer a database from the iosAPPSDK to the PC.   There are some steps to remove it from the plist file but that would not be suitable for a end user and the end user would not be able to transfer the file back.

                             

                            My app is a logbook for sailors and motoboaters.

                            For legal reasons it is absolutely necessary that the user can save a backup copy outside of the iPad. Just imagine the ipad would fall into the water, and thus the total logbook (a legal evidence!) be lost.

                            The iosAPPSDK allows to exchange database files with PC using iTunes. Why should this not be possible for the end user?

                            I have read a few threads from other developers trying to get an iosAPPSDK app into the App Store. They had been asked during review why there is a sharing function. And because there was no reason for this, they removed the sharing. But for my app there IS a reason and so I will explain it to Apple reviewers (directly when uploading and not waiting for asking).

                            There are many, many apps in the App Store created with Xcode using data sharing. Why shouldn't this be possible or iosAPPSDK apps too?



                            • 11. Re: iOS App problem with script trigger on first window
                              schamblee

                              1. Backups can be done with the iosAppSDK..  The save a copy as script step works.  What I have done in my app is to use 'save a copy as' script step with email a copy checked.

                               

                              2. I didn't mean to offend you about the runtime, some users think that everything is compiled into one file.

                               

                              3.  I don't see a feasible way for a end user to transfer iosAppSDK app to be used on a computer and then transfer back to the devices.   I would sync the data between the computer and device.

                               

                              4.  I completed the update process with my app yesterday.   The files must have different name because you can not have two files with the same name in the same location.   The solutions folder is where the database(s) are located, so when a update is done you would have the current file with the updated file in the same location.    When the App is updated the new file is added to the solution folder on the devices. 

                               

                              The iosAPPSDK allows to exchange database files with PC using iTunes. Why should this not be possible for the end user?

                              iTunes is slow and requires the device be connected to a computer.  It may be possible but it is not a method I care to explore.  I would rather email a backup or use dropbox sdk.   I guess your users may not always have an internet connection so your only choice may be iTunes.  I'm sure if Apple sees the need then data sharing may be possible but again this is outside anything I have attempted.  FMI stated that there was no way to update data and the iosAppSDK apps were not for the App Store, but both are possible, so It may be possible for data sharing.

                              • 12. Re: iOS App problem with script trigger on first window
                                almute

                                1. Yes, email would be easy - but my main logbook database has 44 MB without user data. And it is growing soon when the users enter data. So, email is not possible.

                                2. No problem. I'm very familiar with FileMaker since I'm using it for more than 20 years.

                                 

                                3. I didn't find a way for a reliable syncing. I will try again to create such a feature later. The problem is the the amount of tables and fields in my software.

                                 

                                4. Congratulations. I hope that my update feature is also completed now.

                                Did you get your iosAppSDK app connected to Dropbox? This would be fine for me because my users are used to copy the backup to Dropbox. Currently they use my logbook software with FM Go and there it is easy to copy to Dropbox. Bit I didn't find this in the iosAppSDK.

                                • 13. Re: iOS App problem with script trigger on first window
                                  schamblee

                                  I do not have my iosApp working with dropbox yet.  Dropbox has it own sdk and I have seen samples with FM for desktop databases using the that sdk.  My next step is trying to interface my database to dropbox, so I will follow up on here after I have it working.

                                   

                                  FileMaker and OAuth: DropBox to FileMaker Part 1 - SeedCode

                                  • 14. Re: iOS App problem with script trigger on first window
                                    almute

                                    Would be perfect I you could report your effort to getting connection to Dropbox.

                                     

                                    Thanks and good luck!