How to invalidate my app after a certain amount of time in iPhone using provisioning profile
I want my iPhone app to be valid only for a particular time period. This has to be done by provisioning profile and not through the 开发者_如何转开发App Store. Please give me some suggestions.
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
}
精彩评论