How to set a trial period for run application?

Hi all,

How to set a trial period or any other things to protect the application against unauthorized use?

Thanks

This depends on how robust you want it to be.

The most simplistic way would be through the use of a plist to record the date of installation or expiration date:

To log the date:

set nowDateRaw to (current date)
set expirationPeriod to 60 * 60 * 24 * 30 -- (30 days)
set nowDate to (nowDateRaw + expirationPeriod) as text
do shell script "defaults write ~/Library/Preferences/com.acme.datetext.plist nowDate -string " & quoted form of nowDate

to get the date and check:

set expireDateRaw to do shell script "defaults read ~/Library/Preferences/com.acme.datetext.plist nowDate"
set expireDate to date expireDateRaw

if expireDate is less than (current date) then
	log "Expired"
else
	log "not expired"
end if

You may wish to consider other locations

Whatever you do, the best you can hope for is to discourage casual copying. Even with access to Objective-C or C, you can’t stop a determined pirate. Better to spend your energies looking after legitimate users.

Basically I agree with Shane.

There is a open source Objective-C framework called AquaticPrime which provides a more sophisticated copy protection including a trial period option.

Please read this article: http://www.tempel.org/UsingAquaticPrime/
It describes the pros and cons of software protection in general and the usage of AquaticPrime in particular.