/ Published in: Objective C
Using a gcc predefined macro, __DATE__, the code can know for itself when it was compiled, and build in an expiration date based on that value.
The former code (http://snipplr.com/view/3448/kill-app-after-expire-date/) was not internationalised and might cause an issue when run outside of English speaking countries. This code resolves the locale issue.
The former code (http://snipplr.com/view/3448/kill-app-after-expire-date/) was not internationalised and might cause an issue when run outside of English speaking countries. This code resolves the locale issue.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Based on original code by Daniel Jakult, based on an idea from Brian Cooke. #ifdef BETA // 4 week expiration #define EXPIREAFTERDAYS 28 #endif #if EXPIREAFTERDAYS [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; autorelease]]; [dateFormatter setDateFormat:@"MMM dd yyyy"]; [dateFormatter release]; { // Run an alert or whatever // Quit! [NSApp terminate:self]; } #endif
URL: http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux