मैं अलार्म घड़ी प्रो और नाइटस्टैंड एप्लिकेशन के समान अलार्म घड़ी बनाने की कोशिश कर रहा हूं जो वर्तमान में ऐप स्टोर में हैं। अलार्म समय हिट होने पर आमतौर पर 30 सेकंड से अधिक समय तक अलार्म घड़ी ध्वनि चलाने में सक्षम होता है (आमतौर पर अगली सुबह)।अलार्म घड़ी प्रो ऐप जैसे 30 सेकंड से अधिक के लिए अलार्म ध्वनि कैसे चला सकता हूं?
मैं दो दृष्टिकोण पहले से ही कोई भाग्य के साथ की कोशिश की है:
दृष्टिकोण 1:
[self performSelector:@selector(playAlarm) withObject:nil afterDelay:myDouble];
दृष्टिकोण 2:
UILocalNotification *notif = [[cls alloc] init];
notif.fireDate =[datePicker date];//firedate;
notif.timeZone = [NSTimeZone systemTimeZone];
notif.alertBody = @"Time to wake up!";
NSString *SoundFileName=nil;
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"ActualSoundFile"] isKindOfClass:[NSString class]])
SoundFileName=[[[NSString alloc]initWithString:[[NSUserDefaults standardUserDefaults]objectForKey:@"ActualSoundFile"]]autorelease];
else
SoundFileName=[[[NSString alloc] initWithString:@""] autorelease];
if([SoundFileName length]>1)
notif.soundName = [SoundFileName stringByAppendingString:@".wav"];
else
notif.soundName = UILocalNotificationDefaultSoundName;
[email protected]"Snooze";
notif.repeatCalendar=[NSCalendar currentCalendar];
notif.repeatInterval =NSDayCalendarUnit;
NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"Alarm" forKey:kRemindMeNotificationDataKey];
notif.userInfo = userDict;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
[notif release];
किसी को भी पता है कि वे किस तरह कर रहे हैं 7 घंटे के बाद एक लूप पर अलार्म खेलने में सक्षम?
दृष्टिकोण 2 के लिए, क्या यह आपका पूरा कोड है? उस लाइन के बाद आपको निश्चित रूप से अधिक कोड चाहिए। –
@ बेन - बस दो दृष्टिकोण जोड़े। – daSn0wie