终止日期后终止应用程序(自杀代码Redux)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了终止日期后终止应用程序(自杀代码Redux)相关的知识,希望对你有一定的参考价值。
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.
// 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
以上是关于终止日期后终止应用程序(自杀代码Redux)的主要内容,如果未能解决你的问题,请参考以下文章
做个日期查询,判断开始日期与终止日期范围必须在一个月之内,用java代码
Spring Boot / REST - 示例代码在启动后终止