1

我希望我的 iPhone 应用程序仅在特定时间段内有效。这必须通过配置文件而不是通过 App Store 来完成。请给我一些建议。

4

1 回答 1

0

Create a NSDate that represents the end time of your app preview. Then compare it to the current time and if the result is grater then you should exit the app. Although it is better to display a message to the user that the preview period expired as apple does not provide a straight forward way to exit the app.

NSString *dateString = @"25-Dec-10"; 
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];  
dateFormatter.dateFormat = @"dd-MMM-yy"; 
NSDate *endDate = [dateFormatter dateFromString:dateString];

if([[NSDate date] timeIntervalSinceDate:endDate] >= 0){
   //Display message to the user
}
于 2011-08-19T10:08:41.200 回答