Tag: 警报

UIAlert错误,其视图不在窗口层次结构中

我正在研究我的networking连接, 我把检查可达性代码在viewDidLoad,所以我通知用户通过提醒,如果没有networking。 这是我的代码, class ViewController: UIViewController { var reachability : Reachability? override func viewDidLoad() { super.viewDidLoad() if reachability?.isReachable() == true { print("reachable") }else{ let myAlert = UIAlertController(title: "No network", message: "Your network is not working", preferredStyle: UIAlertControllerStyle.Alert) let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil) myAlert.addAction(okAction) self.presentViewController(myAlert, animated: true, completion: nil) } 但如果我尝试在我的模拟器或手机上,它显示错误消息 2015-11-08 […]

计划后在后台播放闹钟铃声

我有一个请求,使一个应用程序,这是一个闹钟应用程序, 这个应用程序应该有能力运行闹钟歌曲,如果应用程序在backgorund 但我已经通过苹果文件,其相当清楚。 每个应用程序将停止执行3分钟后,除非该应用程序是在一个特殊的类别 但我有一个quesiton,我下载这个应用程序, https ://itunes.apple.com/ca/app/step-out-bed!-smart-alarm/id673120263?mt =8 这个应用程序有能力在应用程序在后台运行它的闹钟铃声,即使应用程序处于静音模式,如何有这样做的能力 让他们在后台启用音乐播放,或者他们configuration了无限的后台过期处理程序,但是这会导致拒绝应用程序 我已经看到了这个实现的解决scheme,但不能匹配这个问题的工作过程,我也联系了苹果这个原因,和分配,将更新这一次,我得到一个更新

邮件和消息不会从警报视图中消失

我有一个UIAlertView启动一个电子邮件和消息屏幕。 当用户点击警报button时,两个视图都打开,但是它们不closures。 我有一个尝试添加: -(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [self dismissModalViewControllerAnimated:YES]; } 对class级的身体来说却没有帮助。 以下是电子邮件的介绍: [viewController presentViewController:email animated:YES completion:nil]; 编辑这里是我用来显示电子邮件的整个代码: //send email… -(void)sendEmail{ //mail composer Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); if(mailClass != nil){ if([mailClass canSendMail]){ //get the current view controller from the App Delegate apptester_appDelegate *appDelegate = (apptester_appDelegate *)[[UIApplication sharedApplication] delegate]; UIViewController *viewController = [appDelegate getViewController]; MFMailComposeViewController *email = […]

类似报警的应用程序

我一直在研究任何可能的方式来做AppStore (AlarmMon,Rocket Alarm)中的应用程序的报警应用程序。 即使应用程序在后台,他们也可以连续报警。 我试图closures他们的位置权限的情况下,应用程序使用CLLocationManager更新和扩展backgroundTimeRemaining。 当闹钟正在播放声音时,即使您接到电话也不会停止(您可以接听电话,与主叫方通话并同时听到他们的闹钟声音)。 VoIP和setKeepAlive是苹果公司无法接受的。 (有些开发者告诉他们,使用VoIP时,他们的应用程序被拒绝 播放一个沉默声音似乎是延长backgroundTimeRemaining的一个好方法,但在文档中提到你不应该播放一个沉默的声音。 我做了什么 AVFoundation(AVAudioSession,AVAudioPlayer) AudioServices(AudioServicesCreateSystemSoundID,AudioServicesCreateSystemSoundID,AudioServicesPlaySystemSoundWithCompletion) 第二种方式是播放声音和振动设备正常工作,但问题是它不能播放超过180秒(backgroundTimeRemaing)。 他们在他们的应用程序中所说的关键条件(AlarmMon) 该应用程序不能被用户杀死。 如果应用程序被用户杀死,它会发送一个本地通知的循环。 (来自app的本地通知超过了苹果提及的最大数量(64次),并连续推送。 )

计时器离开应用程序,并返回到iOS

目前在我的iOS应用程序中,当用户退出到主屏幕并返回到应用程序时,它会请求在我的AppDelegate中设置的login凭据。 但是我想要做的是,如果用户退出应用程序,并在例如2分钟内,定时器重置,用户不需要input他的密码。 当用户在2分钟后回到应用程序时,会提醒他再次input密码。 任何帮助将不胜感激。 谢谢!

复制应用程序文件夹后无法启动Xcode 6.1.1

在我们的构build系统上,我们需要保留多个Xcode版本,以便构build更老的项目。 我们为每个主要的Xcode版本(从Finder中)复制Xcode应用程序文件夹。 但是,复制Xcode 6.1.1文件夹后,我无法启动应用程序。 双击复制文件夹(Xcode-6.1.1.app)后,它简要地显示“欢迎”屏幕,然后立即closures它,并显示一个警告: /Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/dyld_sim不属于root。 原来的Xcode.app可以正常打开。 我可以在小牛和优胜美地重现这个问题。 有没有人看过这个? 任何想法如何使重复的Xcode工作? 谢谢!

iOS notification.alert()不能使用Phonegap 2.3.0

当尝试在Xcode 4.6中使用Phonegap 2.3.0使用navigator.notification.alert()时,我遇到了一个奇怪的问题。 我有两个文件,index.html和other.html。 点击index.html中的“testing警报”会触发警报,但是在closures警报并导航到other.html后,单击“testing其他警报”不会触发警报。 但是,如果您在移至other.html之前点击index.html上的两次或更多次“testing警报”,警报将继续按预期运行。 只有在触发警报ONCE和更改页面后警报才会一起运行。 的index.html <!DOCTYPE html> <html> <head> <script type="text/javascript" src="cordova-2.3.0.js"></script> <script type="text/javascript" charset="utf-8"> function alertTest() { navigator.notification.alert('Testing', null, 'Alert Test', 'OK'); } </script> </head> <body> <a href='other.html'>Move to other page</a> <a href="#" onclick="alertTest(); return false;">Test the alert</a> </body> </html> other.html <!DOCTYPE html> <html> <head> <script type="text/javascript" src="cordova-2.3.0.js"></script> <script type="text/javascript" charset="utf-8"> […]

从自定义类中显示alertController

我试图从我所做的类中显示一个AlertController。 由于AlertController是UIResponder的一个子类,我正在使用Xcode提示我的以下代码行 superclass?.presentViewController(alertController, animated: true, completion: nil) 但是我不能编译,因为AnyClass? 没有任何成员presentViewController。 我的类是NSObject的一个子类。 任何其他解决scheme 谢谢

在使用应用程序期间丢失可达性连接时popup警报(IOS xcode swift)

我是IOS应用程序开发的初学者,并希望“在使用应用程序(IOS xcode swift)期间丢失可达性连接时popup警报”,但是我只在启动我的应用程序时才会popup警报。 当互联网连接丢失时,在使用我的应用程序时不会popup警报。 请提供帮助,谢谢! 我做了什么:1)创build一个Reachability.swift文件和worte import Foundation public class Reachability { class func isConnectedToNetwork()->Bool{ var Status:Bool = false let url = NSURL(string: "http://google.com/") let request = NSMutableURLRequest(URL: url!) request.HTTPMethod = "HEAD" request.cachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData request.timeoutInterval = 10.0 var response: NSURLResponse? var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: nil) as NSData? if let httpResponse = […]

使用completionSelector和completionTarget与UIImageWriteToSavedPhotosAlbum

我试图找出一个办法让我的iOS应用程序保存到相机胶卷的屏幕截图,然后popup警告告诉用户屏幕截图已成功保存。 我认为这样做的唯一方法就是使用某种forms的if / else循环(正如您在下面的伪代码注释中看到的那样),但是我想不出任何语法可以使用UIKit的UIImageWriteToSavedPhotosAlbum函数。 我遇到了一些build议,说在Apple的开发网站上使用completionSelector和completionTarget,但我真的不明白如何使用它们,或者我的代码中completionSelector和completionTarget应该使用什么特定的字典。 我对Swift比较陌生。 有人可以解释他们如何工作,以及如何find在我的代码中使用它们的语法? func screenshotMethod() { UIGraphicsBeginImageContextWithOptions(HighchartsView.scrollView.contentSize, false, 0); view.layer.renderInContext(UIGraphicsGetCurrentContext()) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) //if saved to Camera Roll // { // confirmScreenshot() // } // //else // { // exit code/stop // } } func confirmScreenshot() { let alertController = UIAlertController(title: "Success", message: "This chart […]