Check for "Release Build" at runtime - iphone

I'm creating a .framework (or a static library) for a component that I developed and that I'd like to sell to third-parties.
I was planning to add some code to protect the framework from unauthorised re-use, re-distribution or re-sale.
I think a good way to achieve this would be to ask to the purchaser to tell me what is the bundle ID of the app that will use the framework, save it in the framework as an NSString property and create a method that checks at runtime if the bundle ID of the app that is using the framework match or not.
However I'd like also to make the framework available to try for free. Therefore I want to enable the bundle ID check only then the containing app is compiled in released mode, or when the app is running on the end user device, outside the development sandbox.
Of course I can't use any methods that relies on variables or macros set in the project file, because they would be too easy to exploit. I need to do it at runtime... and without any action needed by the purchaser.
Is there a way to check at runtime if an app is running in the developer sandbox or not? Or if an app has been built with the release build profile?
Thanks!

In the past, I have implemented a simple time-bomb expiration in free to eval but not free to deploy components. The library would function up to certain date X, and then stop working. The user would just have to re-download the latest bits to continue evaluating. One paid order, a download link is provided without the the time-bomb or a license file with a digitally signed license disabled the time bomb logic all together. Relying on run-time environmental characteristics is fragile at best.

Related

How to stop sqlite3 database being replaced when the app using it is updated?

I am currently developing a mobile application in Python that uses a sqlite3 database in order to save data. However, if I rebuild and redeploy the application to my mobile device, the existing sqlite3 .db file on the mobile device understandably gets replaced with a brand new one. Is there any way to prevent this replacement from happening? I only plan on using this app for personal use, so it's not that urgent an issue, it would really only be convenient. Any advice would be appreciated!
You probably need to replicate what Android Apps written in Java or Kotlin use.
That is they (typically via SQLiteOpenHelper which is described as A helper class to manage database creation and version management.), check to see if the file exists at the expected location/path.
if not then the database (empty bar sqlite_master and android_metadata) is created and the onCreate method is invoked, allowing the user defined components (tables, indexes, views, triggers to be created).
if so then the database is instead opened.
This is a simplfied, overview, as it undertakes other things such as checking the user_version against a coded version, catering for onUpgrade or the rarely used onDowngrade methods to be utilised.
As such you probably just need to have similar logic to detect if the file itself exists (this as simple as this would be prone to failure should the file, for some reason, not be an actual SQLite file).

iHasApp - App Definitions Update

Do you know how the App definitions in iHasApp are generated / can be updated?
It comes shipped with the following definitions;
https://github.com/danielamitay/iHasApp/blob/master/iHasApp/schemeApps.json
I have run this on number of devices with differing Apps and there are some that are not detected that I am certain have a scheme / URL but are not present in the current definitions. If I manually add their AppID's into the .json, iHasApp detects them and displays the App in the results as expected.
I have considered mining all released AppIDs from the itunes API but this seems like a hefty time intensive process and would populate the json with >600k AppIDs that may not be configured to work as a scheme / URL.
How is the best, most thorough way to update this with working AppIDs and (if possible) Facebook ID's?

How do I create an iPhone app to take a picture and send it back to an Oracle database?

I'm trying to create a program that you can take a photo with your camera, and send it back, where it will then be attached as a field into an Oracle database. An existing app that this is similar to (if I'm not explaining it clearly enough) would be bank apps that allow you to photograph the front and back of your checks, then send them off to a different location to be processed.
From my understanding, I would need some sort of middleware and not access the database directly with the pictures taken, but I'm just trying to get the project off the ground at the moment.
So, my immediate questions are:
What sort of base project template would be the best to use for this kind of app?
What sort of code is required to send a file from one location to another? (I'm mainly used to these scenarios in .NET languages, not in xCode)
Expose an HTTP based service (and that can be written in any language and run on any platform e.g. GNU/Linux).
The app itself would be native iOS, and you can certainly consume web-services.
The server itself is just your basic CRUD system backed by a persistent store, in your case an RDBMS.
[iOS] <-----/net:HTTP/---->[server]<==/LINQ/==>[RDBMS]

Updating iOS resource files remotely

I have an app on the App Store that needs to have its resource data files updated periodically (every 2-3 months). So far, I've just been deploying a new version of the app to the App Store every time I need to do this, but the fact that I have to wait a week or two for the changes to become live is cumbersome.
Theoretically, I was thinking of creating a new "version_control.txt" resource file which tracks the version numbers of every other resource file. Periodically, the app would check its version_control.txt against a version up on some web server, and then download any files that need to be updated.
Do there exist any frameworks or SDKs to handle all of this for me, or do I have to write everything myself? Is there a better solution?
You can't update the resources in your app bundle without updating the entire application. However, there's no problem with having your app retrieve resources from a web server and save them in your app's Documents folder. From there, it's simple to have the app look for its resources in the Documents folder before looking in its own bundle.
I don't know of any frameworks that manage resource versions for you. There's not a lot of work involved, and each app likely has its own requirements, so I'm not sure that a framework would help that much. If your web server supports it, you could request the resource file(s) each time your app runs, but add the if-modified-since header so that you only download a new copy if the version on the server is newer than the one your app already has.
I also had similar problems. I had tried to download some custom files from my ftp domain but that really didn't work very well. Not only I had to pay for the bandwidth, the users weren't very happy about it. The coding complicated considerably. Now, I've decided to update periodically via AppStore. The users are more satisfied since they see updates, but they don't understand is that only a couple of resources have been updated.
PS: I'm not aware of any SDK or framework for it. But you don't need it, you just need to download some files...

How to stage deployment of an app on same server as production?

I've just inherited a CF app from a customer who uses a shared CF hosting provider. I'd like to introduce better processes including the ability to stage app changes that I make for their review. (In the past, they would upload changes and cross their fingers.)
Their app lives in a folder under the webroot. Let's call it "/app". I'd like to create a sibling directory named "/appstaging" where I would publish the latest code. The obstacle is that the hosting provider lets you set paths for custom tags and mappings but not per CF app. The existing settings all point into the /app directory so if I need to make changes to tags, CFCs, etc., I can't test these without affecting the live app. What I want is CF to let me set per-app tag paths and mappings. From what I've read, CF8 lets me do this but the customer is using CF7 (I'm pushing for them to upgrade asap). In the meantime, is there anyway to workaround this or does a smooth way of staging changes have to wait?
(I am currently experimenting with ways to detect which app I am based on using GetCurrentTemplatePath() in application.cfm. The idea is that any code that refers to other files using mappings would use a different mapping. I haven't done enough work there though to know if this will all work out.)
Any ideas or input are welcome. I should point out that the app and its dev env is not very "modern." There are no frameworks involved and no things like ant used for build/deployment. The customer's budget is extremely limited so I'm not looking to convert the app whole-sale but I do need to find cheap ways to get some process in there to keep things sane.
This is a serious, but wacky, suggestion: use a second hosted account.
Write up a cost-benefit analysis of having live and staging servers, and compare that to the cost of a second hosted account. The second account doesn't need massive data allowances, etc, and ought not cost as much as the live account.
Additionally, calcuate the cost of revising the code base to allow live and staging on the one account and compare that to the cost of a second hosting account.
Remember that you wont need the second account once your real upgrade is complete.
I expect you'll need to do something like defining the custom tag paths in a config file that gets loaded into the application scope. But that'll require some serious code refitting.