ios10

EXC_BAD_INSTRUCTION only in iPhone 5 simulator

限于喜欢 提交于 2019-12-02 13:32:01
问题 Running my code on the iPhone 5 simulator throws the exception shown in the image. Running the code on any of the other simulators is just fine. I can't spot where I made a mistake in this unspectacular line of code. Does anyone else have this problem? 回答1: NSInteger (which is a type alias for Int in Swift) is a 32-bit integer on 32-bit platforms like the iPhone 5. The result of NSInteger(NSDate().timeIntervalSince1970) * 1000 is 1480106653342 (at this moment) and does not fit into the range

How to perform conditional segue

时光怂恿深爱的人放手 提交于 2019-12-02 11:27:23
I've created a segue through IB. When buttonA is clicked, a transition to viewB will occur. In the button click action, I have performSegue(withIdentifier:sender:) wrapped in a condition. I want the segue to occur only if the condition is true. However, once the user clicks the button, the segue happens before the condition is even run. What is the best way to transition programmatically while still using segue identifiers defined in IB? You have created segue from the UIButton to a viewController that is the reason segue happens before the execution of condition. Instead of that remove that

CFRelease crash in iOS10

为君一笑 提交于 2019-12-02 10:41:00
Below is my code, which used to work fine till iOS 9. - (NSData *)encryptWithDataPublicKey:(NSString*)data keyTag:(NSString*)tag { SecKeyRef publicKey = NULL; NSData *publicTag = [NSData dataWithBytes:[tag UTF8String] length:[tag length]]; NSMutableDictionary *queryPublicKey = [[NSMutableDictionary alloc] init]; [queryPublicKey setObject:(__bridge id)kSecClassKey forKey:(__bridge id)kSecClass]; [queryPublicKey setObject:publicTag forKey:(__bridge id)kSecAttrApplicationTag]; [queryPublicKey setObject:(__bridge id)kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType]; [queryPublicKey setObject

Is there a way to open urls received in a push notification without opening the app in ios 10?

送分小仙女□ 提交于 2019-12-02 09:44:26
I am trying to open a url that is passed in a push notification in ios 10. So far I haven't found a way to open a the url without opening the app. Is there a way to open urls received in a push notification without opening the app? I have found a work-around to open the url (the work-around works for ios <10), but then again the app opens up first. Update: I've noticed that for the device (iOS 10.0) The following mentohds get involked application:didRegisterForRemoteNotificationsWithDeviceToken userNotificationCenter:willPresentNotification: userNotificationCenter

How to restrict button click

☆樱花仙子☆ 提交于 2019-12-02 09:33:05
I have a VC like this for the checkBoxes i have embedded UIButtons and i am changing their image on click. Here's my code @IBOutlet weak var bestSellerButton: UIButton! @IBOutlet weak var trendingButton: UIButton! @IBOutlet weak var lowToHighButton: UIButton! @IBOutlet weak var highToLowButton: UIButton! var isBoxClicked = Bool() func updateCheckImageOnClick(button: UIButton) { if isBoxClicked == true { isBoxClicked = false button.setImage(UIImage.init(named: "checkmark"), for: UIControlState.normal) } else { isBoxClicked = true button.setImage(UIImage(), for: UIControlState.normal) } }

Sound issues fixes for iOS 10 Push Notifications

不打扰是莪最后的温柔 提交于 2019-12-02 08:13:27
I’ve implemented push notifications for our app. on iOS 9, the sound words fine. on iOS 10, it’s very unpredictable. Fresh install from Xcode on iOS 10.0.2 would bring up my custom sound. reinstall would bring up default sound. I don’t know exactly when but at times I also get no sound. reading from here and many others my conclusion is that it works after a hard reboot. 2 questions: Has Apple completely fixed this issue in any version? If so what version? After a hard reboot, would the problem completely go away? Or you need to do it again? if so when? Honey Has Apple completely fixed this

Xcode 8.0 CBCentralManager Issue

两盒软妹~` 提交于 2019-12-02 08:01:23
I recently downloaded Xcode 8.0 and trying to run my previous project which uses core bluetooth. I have enabled Use Legacy Swift Language Version in build setting for compatibility in swift 2.3 everything works, but one Issue occured, func centralManagerDidUpdateState(central: CBCentralManager) { print("state is \(central.state.rawValue)") if (central.state == CBCentralManagerState.PoweredOn) { self.centralManager?.scanForPeripheralsWithServices([serviceUUID], options: nil) } else { // do something like alert the user that ble is not on } } previously central.state would return

iOS10 - transparent app background

…衆ロ難τιáo~ 提交于 2019-12-02 05:16:59
问题 How can I make the background of my app semi-transparent so that I can show the home screen wallpaper, like "Reminders" iOS app? 回答1: This is one of those goodies that Apple reserves for themselves, unfortunately. Because your app is sandboxed (can't see inside other apps), you're only allowed to use what iOS will allow you to use. When your app is loaded, the app is then what's shown on the iOS stack, independent of the home screen, and Apple doesn't make the home screen available to you.

Media Attachment in iOS 10 Push Notifications

跟風遠走 提交于 2019-12-02 04:28:51
问题 I'm struggling with adding an image to my Push Notification in iOS 10. I have added a Notification Service Extension, and have used the following code: override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let urlString = request.content.userInfo["image-url"] as? String, let fileUrl =

Whatsapp integration and openURL issue in iOS 10

自古美人都是妖i 提交于 2019-12-02 03:44:23
问题 I have integrated whastapp in my iOS app. When I tested it in my iOS 10 device. It crashes with an issue. Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates. NSURL *whatsappURL = [NSURL URLWithString:[NSString stringWithFormat: @"whatsapp://send?abid=%@&text=WelcomeToChatBought",[abidArray objectAtIndex:buttonclicked.tag-1000]]]; if ([[UIApplication sharedApplication