Tag: ios10

iOS 10 UserNotifications不适用于已迁移的应用程序

我有一个使用Swift 2.3构build的应用程序,并在iOS 9.3上进行了testing,使用本地通知,并且工作正常。 当我更新我的应用程序到Swift 3和新的UserNotifications框架应用程序停止显示通知。 我testing了一个新的项目,我的代码工作得很好。 相同的代码。 经过大量的testing发现问题,似乎导致问题的一件事是我的包标识符。 新项目有一个不同的,当我改变到原来的标识符停止工作。 改回任何其他的标识符,它又开始工作。 我无法更改包标识符,因为该应用程序已经发布在应用程序商店。 有没有人看过类似的东西? 任何人都可以帮我吗? 谢谢你们!

快速执行select器与对象3

我想在swift 3.0中用对象执行select器 我有一个select器有一个参数 func imageSelected(aImage : UIImage) 我就是这样称呼的 viewC.perform(Selector.init("imageSelected:"), with: image, afterDelay: 0.1) 但是,应用程序崩溃,select器没有定义的错误。

为UITableView节标题返回CGFloat.leastNormalMagnitude会导致崩溃

我做了一个iOS 8的应用程序,使用分组的UITableView作为它的一个页面。 其中有多个部分使用CGFloat.leastNormalMagnitude (或Swift 2及以下的CGFloat.min )作为部分页眉和页脚高度来删除“默认”空间。 一切都很顺利,直到应用程序运行在iOS 9和10,它崩溃的这个错误: 终止应用程序由于未捕获的exception“NSInternalInconsistencyException”,原因:“节标题高度不得为负 – 节0提供的高度是-0.00000' 不知何故, 1任何值(除了舍入的0 )都被视为负数 – 使用1作为返回值将使页眉/页脚空间再次出现。 有没有解决这个问题的方法? 提前致谢。

立即触发重复本地通知 – 如何推迟?

我的目标是设置一个将在第一时间发生N秒的通知,然后每N秒重复一次。 但是,创build重复通知似乎会立即触发UNUserNotificationCenterDelegate 。 应用程序委托: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let center = UNUserNotificationCenter.current() center.delegate = self return true } func startRequest() { let content = UNMutableNotificationContent() content.body = bodyText content.categoryIdentifier = categoryIdentifier content.sound = UNNotificationSound.default() let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true) trigger.nextTriggerDate() let request = UNNotificationRequest(identifier: UUID().uuidString, content: […]

UNNotificationServiceExtension:内存限制?

我试图实现UNNotificationServiceExtension,但我的代码似乎经常失败,简单地说明 Program ended with exit code: 0" 我正在尝试在扩展中使用FMDB Sqlite3模块,好像我可能会在扩展内部运行内存限制。 在这些扩展中是否有logging的限制? 有没有什么策略可以帮助我把它们考虑进去,还是我不得不接受,我不能把复杂的function放到扩展中去? 通过仪器运行表明它只能达到3.24MB。 和NSExtensionMain是68%,所以我不认为我可以把这个很多。

iOS10 NSLog限制为1024个字符的string

在iOS10中,NSlog被限制为1024个字符,任何人都知道打印完整string的解决方法。

使用'document.body.scrollHeight'计算UIWebView内容dynamic高度 在iOS 10中返回更大的值

我正在使用Objective C创build一个应用程序,我正在使用UIWebView以HTML格式显示内容。 我在UIWebView委托方法webViewDidFinishLoad使用下面的代码 NSUInteger contentHeight = [[aWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@“document.body.scrollHeight;”]] intValue]; 计算webview内容的高度,这在iOS8 , iOS9和iOS11工作正常,但在iOS10 iPhone手机的内容高度返回比实际的内容价值更大的价值。 正因为如此,我在屏幕底部显示了一些额外的空白。 我尝试了所有的解决scheme,但只有在iOS 10中获得相同的错误的内容高度。请帮我解决这个问题。 先谢谢你!

iOS 10不会调用通知服务扩展

我试图实现新的通知服务扩展,但我有一个问题。 在我的NotificationService.swift文件中,我有这样的代码: class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { // Modify the notification content here… bestAttemptContent.title = "\(bestAttemptContent.title) [modified]" print(bestAttemptContent.body) contentHandler(bestAttemptContent) } } override […]

iOS 10 beta版Safari中的window.outerWidth为0

使用安装了iOS 10的iPad,我在浏览器控制台中input了window.outerWidth ,并获得了值0 。 OTOH, window.innerWidth正确产生了1024 (横向模式)。 在iOS 9中, window.outerWidth正确地产生了1024 ,那么这仅仅是iOS 10 beta中的一个错误,或者是我对这个属性的微妙之处?

Swift 3中的AVCaptureStillImageOutput与AVCapturePhotoOutput

我想简单地把我的视图控制器中的相机视图。 我在顶部导入了AVFoundation ,以及UIImagePickerControllerDelegate和UINavigationControllerDelegate类。 然而,每当我尝试使用AVCaptureStillImageOutput ,Xcode告诉我,它已被弃用iOS10,我应该使用AVCapturePhotoOutput 。 这是完全好的,但是,只要我想调用stillImageOutput.outputSettings , .outputSettings本身不可用。 因此,我不得不使用AVAVCaptureStillImageOutput它的工作,但我有多个警告,因为这个function已被弃用iOS10。 我search和search,但无法真正find解决scheme。 我将衷心感谢您的帮助。 我正在学习,所以任何解释都会很棒! 代码如下。 import UIKit import AVFoundation class CameraView: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { var captureSession : AVCaptureSession? var stillImageOutput : AVCaptureStillImageOutput? var previewLayer : AVCaptureVideoPreviewLayer? @IBOutlet var cameraView: UIView! override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) captureSession = AVCaptureSession() captureSession?.sessionPreset = AVCaptureSessionPreset1920x1080 var backCamera […]