So, you've built and distributed your app successfully. But now you'd like to apply an update to your app. What now?
Luckily applying an update to your app in LiveCode for FM is a simple process. Just follow the steps outlined in this lesson!
Apply updates to FileMaker file
The first step in updating your app is to make any changes and updates you desire to the FileMaker file linked to the LiveCode for FM project of your app. Once you have done this, open LiveCode for FM.
Re-compile project to apply changes
From the my projects screen click the "Edit" button on the project you wish to update.
Now you should be on the Solution Details page. From here, double check that the FileMaker file you applied your updates to matches the location of the file listed in the project. Then proceed by clicking "Continue".
At this point LiveCode for FM will take over your computer and begin applying the changes made to your FM file to the LiveCode for FM project. Remember not to touch your computer during this time as it can interfere with the process!
Once this is completed you should be on the layouts page. If your update requires you to include any more/less layouts in your solution you would apply these changes here. If you haven't made any changes to the layouts you can proceed past this step by clicking "Continue".
The next page displayed will be add/remove tables. The same rules apply here as the layouts page. Once you have applied any tables changes you can proceed by clicking "Continue".
The sync settings layout should now be displayed. Apply any changes to your sync settings (if any). Once you have done this proceed to the deployment page by clicking "Next". If you are not syncing to a FileMaker server you can ignore this step.
Now you should be on the deployment page. From here, click the "Edit" or "Edit this deployment profile" button for the deployment profile you wish to deploy. This will bring up the deployment settings window.
Inside this window you want to make sure of a few things.
1. The identifier. The app identifier needs to be the same as the built application you are wanting to update. Without this, devices can't recognise the file as an update and will install a whole separate app rather than updating your existing one.
2. Another important setting is the version number. When you apply an update you should reflect this by incrementing the version number. Note: this is a requirement if you are going to submit your update to the app stores.
3. Next you want to double check that the Clear Application Data setting is set to how you need it. There is more information on how data works when updating your app further on in this lesson.
If the rest of the settings in this window are set to your liking you can then close this window by clicking "Done".
At this point we highly recommend using the test feature to test your application to make sure the update applied is working correctly in the compiled app. Repeat these steps for all provisioning profiles/platforms you are looking to update. Once you are satisfied with your testing we can then move on to building and distributing your update to your users.
Will local data on my users devices be lost during the update process?
You're now ready to build and distribute the update to your users but you have concerns of what may happen to the local data within your app thats already on your users devices.
If you want to preserve your users local data when updating there are a couple of options that allow this. If you have the clear application data setting set to "Never" then users local data will not be lost after installing your update as local data is never cleared whatsoever.
If you have the clear application data setting set to "Build number change" then local data will be cleared only when you update AND when the build number is also incremented. Useful for if you only wanted to clear local data for certain updates and not all.
Alternatively, you may want to clear local data on users devices when they install your update. This is also possible! If you have clear application data set to "Version number change" then local data will be cleared on all devices only when they update, and the "Always" setting means that every time your users close the app local data will be cleared.
Note: If you make changes to the structure of your FM database in the update e.g adding/removing/editing tables, layouts or fields then local data is likely to be cleared regardless of the "Clear Application Data" setting. If this is a problem for you we recommend implementing a way users can either export their data or be stored on a server.
Build and distribute your update
Now your update is ready to build and distribute! Click "Build app for distribution" and make sure the app ID entered matches that of your original app you'd like to update and click "Continue" to proceed. The tool will then build you app. You'll want to repeat this for all platforms you're deploying to. Once built click "Open in finder" to view either your .app, .apk or .ipa file. You can also find these inside the relevant project folder.
All that's left to do now is to either submit your file to an app store or distribute to your users an alternative way. There's no need for users to delete the existing app from their device as installing the update will overwrite the original. Congratulations on successfully deploying your first update!