Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Write software that expires?

Write software that expires?
Thread Tools
ruttopia
Forum Regular
Join Date: Oct 1999
Location: Baltimore, MD
Status: Offline
Reply With Quote
Aug 9, 2003, 08:14 AM
 
How is software written that expires (such as Safari betas)? I searched on google and couldn't find anything that really answered my question - and I'm looking for a Mac approach (rather than Windows software). Does anyone have any ideas?

And how would one go about ensuring that the software _stays_ expired?? Just creating a text file somewhere won't solve the problem...

Just curious. Of course I realize a complete format of a drive and reinstall of the OS are impossible to counter, but I'm just looking for an answer to the average case (on the Mac at least) where users don't format/reinstall the OS every week.

Thanks for any help!
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 9, 2003, 09:48 AM
 
You have basically two options.

The first is a text file. This can work pretty well if you make it invisible, put it somewhere obscure, and name it in such a way that it's not easily identified. For example, RealBasic makes a file called " Icon" in your preferences folder where the first character is nonprintable and the file is invisible.

The second is to write code that modifies its own binary. Just change a value in a resource that sets it to expired. This is tricky though and works better if your app is a bundle than if it's not.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
DSHwrd
Junior Member
Join Date: May 2002
Location: Okinawa, Japan (Kadena AB)
Status: Offline
Reply With Quote
Aug 9, 2003, 12:45 PM
 
It also depends on what you want to do. If you want to do a 30 day trial, then the above post is what you should do (one of those two options). If you want to set up your application so that it shut's down on a certain date (say October 1, 2003), then you have to programmatically add that to your program (do a check on startup, if this date doesn't equal "10/01/03" then quit).

Good luck,
- Daniel
Daniel Howard | Mac OS X (10.2.2) | TiBook867 /\ iSub w/ Soundsticks /\ iPod
www.midnite-liteman.com | ideaSpiral 1.5.3 / DVD Rack 1.0.2
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Aug 9, 2003, 03:44 PM
 
If you're talking about a fixed, one-time expiration -- e.g. this beta version expires on November 1 for everybody -- the simplest way is to just hard-code a date and check against it on startup. In Cocoa...
Code:
NSCalendarDate *expirationDate; expirationDate = [NSCalendarDate dateWithYear:2003 month:11 day:1 hour:0 minute:0 second:0 timeZone:[NSTimeZone systemTimeZone]]; if ([[NSDate date] compare:expirationDate] == NSOrderedAscending) // show 'software expired' dialog and quit
Actually, it might also be good to check the date at other times, like when a new document is created, if you're concerned about the app being left running for a long time.

At Omni, expiration dates are a feature of our licensing system; when you buy a license from our online store you get one that never expires, but we can also generate expiring licenses (such as the ones you get from the 'Trial license' links on our store). When we do an expiring beta version of one of our apps, we set a compile-time switch that makes the app not run without a valid license, and then ship it with an expiring license.

If you're looking at making expiring trial versions of your software, then it gets a little more tricky. Usually people expect an "expires N days after you download it" approach. The problem there is that the expiration date then has to be set dynamically by the software itself, instead of set at compile time by the developer. You'd need to record the date somewhere the first time you run the app, and then check against that later to see if you've expired. If you don't record the date securely (or obscurely) enough, some users will realize that they can delete a certain file and keep using your expiring software forever.
Rick Roe
icons.cx | weblog
     
ruttopia  (op)
Forum Regular
Join Date: Oct 1999
Location: Baltimore, MD
Status: Offline
Reply With Quote
Aug 17, 2003, 07:37 AM
 
Great responses - got what I needed. Thanks everyone!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:45 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,