iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL

I figured this one out. createDirectoryAtPath() is unable to process a path with the “file://” prefix. To get a path without the prefix you must use path() or relativePath(). let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]) let logsPath = documentsPath.URLByAppendingPathComponent(“logs”) do { try NSFileManager.defaultManager().createDirectoryAtPath(logsPath.path!, withIntermediateDirectories: true, attributes: nil) } catch let error as NSError { … Read more

UIPopoverPresentationController should have a non-nil sourceView or barButtonItem set before the presentation occurs on iOS 9

You can create a popover presentation controller like this also and it may work – (IBAction)showPopup:(UIButton *)sender { ViewController *contentViewController = [[ViewController alloc] init]; contentViewController.preferredContentSize = CGSizeMake(200, 200); contentViewController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popoverpresentationController = contentViewController.popoverPresentationController; popoverpresentationController.delegate = self; popoverpresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp; popoverpresentationController.sourceRect = sender.bounds; popoverpresentationController.sourceView = sender; [self presentViewController:contentViewController animated: YES completion: nil]; }

Xcode7 | Xcode UI Tests | How to handle location service alert?

Xcode 9 let springboard = XCUIApplication(bundleIdentifier: “com.apple.springboard”) let allowBtn = springboard.buttons[“Allow”] if allowBtn.exists { allowBtn.tap() } Xcode 8.3.3 _ = addUIInterruptionMonitor(withDescription: “Location Dialog”) { (alert) -> Bool in alert.buttons[“Allow”].tap() return true } app.buttons[“Request Location”].tap() app.tap() // need to interact with the app for the handler to fire Note that it is a bit different as … Read more

tech