Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
What is the best approach of making a timed demo? My app has gotten much better and version I send out to friends and testers I want to.

I am guessing when they open the app for the first time it records the date and I save that information using the NSUserDefaults and check the date when it launches? If the date exceeds the demo time it quits out the program.

But if they keep downloading, or duplicating the app they get another 7 days if it is embedded in the app. So storing some file on the computer would also be needed?

What is the best approach?
 
What is the best approach?

The best approach is to break the problem down into simpler parts, then solve the simpler parts. You've already given more than enough information to do this yourself.

Here are the parts:
1. Get the current date.
2. Check for a file with a recorded date.
3. If not found, create file and record current date + expiration interval (7 days).
4. If file is found, read previously recorded date.
5. If current date exceeds recorded date, quit.

#1 can use NSDate. #2 can use NSFileManager. #3 can use any of the classes that can write to a file (e.g. NSArray, NSDictionary, NSData). #4 can use the same class as #3, with xxWithContentsOfFile used to read the data. #5 can use NDate, or if the date is stored as a simple NSNumber, use NSNumber.

Breaking things down into smaller solvable problems is how all software is written. You'll only learn how to do it by practice. I strongly recommend doing it yourself for this relatively simple and well-described problem.
 
Opps, I was checking both the Mac and iPhone forums and did not switch back to post in the correct forum. Thanks for checking Jim!

Chown33 - That is kind of what I was thinking too. But since it was the first time doing this I thought I would check to make sure I was not missing something. The only loop hole I can see is if the end user searches by creation date and finds the date file on the computer and tosses it out. Then my app will generate a new one with a new date. Perhaps I can create a BOOL value that I can store inside the app that switches to TRUE if it has already created a file on the hard drive. Or make the file invisible or not searchable?

Sorry, if someone has the ability to move this to the correct forum that would be great.
 
Sorry, if someone has the ability to move this to the correct forum that would be great.

The way to do this is: report your first post, and in the box that comes up, ask the moderators to move the thread to the Mac Programming forum.

The Report Post icon looks like this, at lower-left of each post:
report.gif


I'd do it, but once again, practicing it yourself is ultimately a better approach.

Use the same approach to delete a post: report it and ask for it to be deleted.
 
Last edited:
Thread moved (was watching the Forum Spy)

Your avatar now makes sense. A watchful eye, ready to leap. ;)

----------

Chown33 - That is kind of what I was thinking too. But since it was the first time doing this I thought I would check to make sure I was not missing something. The only loop hole I can see is if the end user searches by creation date and finds the date file on the computer and tosses it out. Then my app will generate a new one with a new date. Perhaps I can create a BOOL value that I can store inside the app that switches to TRUE if it has already created a file on the hard drive. Or make the file invisible or not searchable?

Exactly what are you trying to accomplish? Who are you trying to defend against?

If you're just trying to provide simple updates, keep it simple. Forget about any loopholes, they aren't worth pursuing or preventing.

If you're trying to defend against an active adversary, don't even bother, because anything you can think up, they can counter. They can always outsmart you, and they can use every tactic you employ against you, simply by looking at the code of your program. If you think they can't figure things out from the compiled code, then they've already outsmarted you: they can and they do.
 
Last edited:
I am not trying to defend against anyone. I am looking for feedback from some end users. I would like to place a post on a role playing site and allow users to download and use the app for 7 days. Then see what they had to say about it so I can revise features. The finished product I might add to the App Store for OS X apps. But if I release it to people and the can easily bypass the demo then I don't want to do it.

I understand that no software is safe from hackers. But with no experience in this area I did not want to make a stupid mistake that made it obviously easy for people to defeat it. Someone must have done this before me. So I was wondering by using NSdate if I should store the information in the app it's self and on the computer as well to check to see if the demo expired, or any better ideas.

Thanks Chown33
 
I am not trying to defend against anyone.
Yes you are, and you say so right here:
But if I release it to people and the can easily bypass the demo then I don't want to do it.


I understand that no software is safe from hackers. But with no experience in this area I did not want to make a stupid mistake that made it obviously easy for people to defeat it. Someone must have done this before me. So I was wondering by using NSdate if I should store the information in the app it's self and on the computer as well to check to see if the demo expired, or any better ideas.
You've missed my point. Even people who have experience in this area have been defeated by hackers. Even people with lots of experience have been defeated by hackers. Even if you put your app on the Mac App Store, with no demo version for end users, it can still be defeated by hackers.

So anything you've proposed so far, or pretty much anything you can think up, can be defeated by hackers. Even pretty much anything I can think up can be defeated by hackers. It's a losing game to get into that arms race.
 
Host a web service that authenticates with a username/password. Maybe using a facebook account?

Or you could generate a hash based on the computer's hardware signature and some other random values like the name of the user. Then you could authenticate access against a web service.

That will prevent the simple "delete the file" type attack. Obviously the hardcore hacker will get through anything.
 
I think you need to ask yourself if all of this effort would really honestly be worth it. Are these people you are sending your beta version to really going to try to scam you, and does it really matter anyway? That is, if you are planning to sell this app, do you really have so many beta testers that its going to significantly eat into your theoretical profits if none of them buy the app when it's released? Or to look at it another way, maybe these people deserve a free copy of your software if you're using them to get feedback and improve it.
 
Good Points. I think I was over thinking the problem. The answer I came up with is to limit features of the app. Have it time out after 5 minutes and limit the number of items they can add to an NSPopUpButton. That seems to be the best approach for now for creating a testable demo of the app.

Thanks.
 
Good Points. I think I was over thinking the problem. The answer I came up with is to limit features of the app. Have it time out after 5 minutes and limit the number of items they can add to an NSPopUpButton. That seems to be the best approach for now for creating a testable demo of the app.

Thanks.

It's called crippleware.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.