ios8

unexpectedly found nil while unwrapping an Optional

扶醉桌前 提交于 2020-06-17 03:09:04
问题 @IBOutlet weak var groupNameTF: UITextField! var group: Group? { didSet { groupNameTF.text = group?.name } } Can't understand what the problem with optional here. As I see from logs, group isn't nil . As I thought I do safe value unwrapping. I also checked with if let construction, same result. 回答1: Most likely that happens because groupNameTF is nil. A quick workaround is to protect that with an if: var group: Group? { didSet { if groupNameTF != nil { groupNameTF.text = group?.name } } } 回答2

unexpectedly found nil while unwrapping an Optional

依然范特西╮ 提交于 2020-06-17 03:07:27
问题 @IBOutlet weak var groupNameTF: UITextField! var group: Group? { didSet { groupNameTF.text = group?.name } } Can't understand what the problem with optional here. As I see from logs, group isn't nil . As I thought I do safe value unwrapping. I also checked with if let construction, same result. 回答1: Most likely that happens because groupNameTF is nil. A quick workaround is to protect that with an if: var group: Group? { didSet { if groupNameTF != nil { groupNameTF.text = group?.name } } } 回答2

Loading local file in WKWebView doesn't working in device

北战南征 提交于 2020-05-29 07:40:23
问题 I can't load local epub file (from document directory) in wkwebview. It's working in simulator but not in device. I learned that it's a bug for iOS 8 from here. Is it already solved for iOS 8 ? Please help me what should i do. I got error in device as - The operation couldn't be completed. (KCFErrorDomainCFNetwork error 1.) Here is code snippet - -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.webView removeObserver:self forKeyPath:@"loading"]; [self

iOS8 extension needs own provisioning profile?

怎甘沉沦 提交于 2020-05-09 18:25:20
问题 I am starting an iOS 8 extension but I can't run it on my device. The error when trying to run it is: No matching provisioning profiles found The provisioning profile specified in your build settings (“ExtensionName”) has an AppID of net.company.AppName which does not match your bundle identifier net.company.AppName.ExtensionName . Xcode can resolve this issue by downloading a new provisioning profile from the Member Center. Do I need a separate provisioning profile for both the main app and

iOS8 extension needs own provisioning profile?

我是研究僧i 提交于 2020-05-09 18:24:21
问题 I am starting an iOS 8 extension but I can't run it on my device. The error when trying to run it is: No matching provisioning profiles found The provisioning profile specified in your build settings (“ExtensionName”) has an AppID of net.company.AppName which does not match your bundle identifier net.company.AppName.ExtensionName . Xcode can resolve this issue by downloading a new provisioning profile from the Member Center. Do I need a separate provisioning profile for both the main app and

APNS push working in foreground but not background

无人久伴 提交于 2020-04-19 04:42:30
问题 Is it possible to have foreground push come in, but not receive push notification when the app is in background? I've had some users report this problem and was wondering what could be the cause. Maybe it's just confusion? Please enlighten me if anyone else had the same problem and if so what the cause was. Thank you! 回答1: Perhaps you could exclude the alert in the payload dictionary of the push. This might prevent the message from being displayed on the device you push to. You could however

APNS push working in foreground but not background

泄露秘密 提交于 2020-04-19 04:39:41
问题 Is it possible to have foreground push come in, but not receive push notification when the app is in background? I've had some users report this problem and was wondering what could be the cause. Maybe it's just confusion? Please enlighten me if anyone else had the same problem and if so what the cause was. Thank you! 回答1: Perhaps you could exclude the alert in the payload dictionary of the push. This might prevent the message from being displayed on the device you push to. You could however

APNS push working in foreground but not background

戏子无情 提交于 2020-04-19 04:38:38
问题 Is it possible to have foreground push come in, but not receive push notification when the app is in background? I've had some users report this problem and was wondering what could be the cause. Maybe it's just confusion? Please enlighten me if anyone else had the same problem and if so what the cause was. Thank you! 回答1: Perhaps you could exclude the alert in the payload dictionary of the push. This might prevent the message from being displayed on the device you push to. You could however

IOS8 Autolayout with relative width / height

不羁的心 提交于 2020-04-11 05:09:11
问题 I need to autolayout a storyboard UIView with a single UIControl. The UIControl should be centered, needs to have a aspect ratio of 1:1 and should always use 90% of the superviews width or height depending on the device orientation without clipping. I added 4 constraints Center Y Alignment - View - Superview Center X Alignment - View - Superview Equal Widths - View - Superview with multiplier set to 0.9 Aspect Ratio - View - View with multiplier set to 1:1 This setup works fine in portrait

Custom vibration in iOS 8 - Swift

余生长醉 提交于 2020-02-23 09:37:07
问题 I'm writing a sprite kit-based app in swift and need to make a short haptic feedback using vibration so first I imported AudioToolbox and used this AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) and it worked well but it vibrates for too long and there's no way to control this duration. Then after some searching I read Kevin Cao's answer here: Are there APIs for custom vibrations in iOS? but unfortunately AudioServicesPlaySystemSoundWithVibration private function was only