swift3

Appending text to NSTextView in Swift 3

左心房为你撑大大i 提交于 2019-12-22 00:09:02
问题 I am building an application that utilizes an MDM API to make bulk updates to attributes of devices. I am looking to have some sort of visible output/logging in the main view so that the user can see what lines of their CSV may have failed and what the HTTP Response Code was. I can append to an NSTextField or a label easy enough, but seeing as how there may be a large output with many lines, I'd like to have a scrollable text box to append the information to. All of the documentation that I

Google and Facebook Firebase Auth using swift 3

邮差的信 提交于 2019-12-21 23:55:41
问题 My google sign is not prompting users to allow permissions in their profile while facebook is prompting. Why? I am implementing my google login in view controller not in app delegate like in the guide. I'm not sure what i did is correct. I've been trying to implement this for hours. Here's my code: apple delegate.swift class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:

Segue from GameScene to a viewController Swift 3

混江龙づ霸主 提交于 2019-12-21 23:18:47
问题 I need to make a segue from a GameScene to a UIViewController. My code so far is the following: In the GameViewController.swift I added: if let view = self.view as! SKView? { if let scene = SKScene(fileNamed: "GameScene") { scene.scaleMode = .aspectFill scene.viewController = self view.presentScene(scene) } ... and in my GameScene.swift I added class GameScene: SKScene, SKPhysicsContactDelegate { var viewController: UIViewController? ... as well as func returnToMainMenu(){ self.viewController

Swift 3 - Prepare Segue

自古美人都是妖i 提交于 2019-12-21 20:50:25
问题 I have 3 scenes in my storyboard. My initial View Controller is a Navigation Controller, then there is a relationship root view controller to a UI ViewController (view controller a) and then I have a push segue from a button in the ViewController to the third ViewController (view controller b) in the scene. I have given the push segue an identifier. Now I am trying to prepare my segue in the 2nd view controller (view controller a) like so: override func prepare(for segue: UIStoryboardSegue,

CIDetector won't release memory - swift

吃可爱长大的小学妹 提交于 2019-12-21 20:43:46
问题 After the face detection is done the memory will not release, is there is a way I could release it (the memory stay at 300MB after the process is done). autoreleasepool{ manager.requestImageData(for: asset, options: option){ (data, responseString, imageOriet, info) in if (data != nil){ //let faces = (faceDetector?.features(in: CIImage(data: data!)!)) guard let faces = self.faceDetector?.features(in: CIImage(data: data!)!) else { return } completionHandler((faces.count)) }else{ print(info) } }

Unable to tap (x,y) coordinate in landscape mode

拜拜、爱过 提交于 2019-12-21 20:28:36
问题 In Xcode 8 / Swift 3, using the coordinate(withNormalizedOffset: CGVector) function to interact with an XCUIElement appears to work only in portrait mode. To test this functionality, I created a single screen project with a button centered in the view. I then ran the following UI test: func testExample() { XCUIDevice.shared().orientation = .portrait let window = XCUIApplication().windows.element(boundBy: 0) let centerPoint = window.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))

ambiguous use of selector dataTask(with: completionHandler:)

泄露秘密 提交于 2019-12-21 18:00:30
问题 I'm trying to get a selector of the dataTask(with:completionHandler:) method defined in URLSession which uses URLRequest object like below, but getting error as there are two methods with slightly two different params names (overloaded methods - 1. one uses URLRequest object as param and another uses URL) : let dataTaskSelector = #selector(URLSession.dataTask(with: completionHandler:)) I have tried a different approach like below (mentioned in https://github.com/apple/swift-evolution/blob

Swift 3 iMessage Extension doesn't open URL

匆匆过客 提交于 2019-12-21 17:54:46
问题 I am creating an iOS Application iMessage Extension. According to Example by Apple, I creating a message according to provided logic guard let url: URL = URL(string: "http://www.google.com") else { return } let message = composeMessage(url: url) activeConversation?.insert(message, completionHandler: { [weak self] (error: Error?) in guard let error = error else { return } self?.presentAlert(error: error) }) also private func composeMessage(url: URL) -> MSMessage { let layout =

Resizing text in UIWebView - Swift 3

血红的双手。 提交于 2019-12-21 16:53:18
问题 I having a problem, resizing text within a UIWebView , the html file is located within the bundle. I have managed to get a modified script to work within obj-c , however using swift 3 there is no change to the text size, although the optimal value changes correctly at each click of the button . Here is the code - import UIKit class ViewController: UIViewController { @IBOutlet var resWebView: UIWebView! @IBOutlet weak var increaseFont: UIBarButtonItem! @IBOutlet weak var decreaseFont:

AudioPlayer and lockscreen/control center control Swift [closed]

最后都变了- 提交于 2019-12-21 15:15:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm new on Swift. I write because I want to ask a question. Me and my friend we are developing an audio player, but we have a problem. The player also works in background and remote controls from the lockscreen and the control center work, but if music is interrupted by one of these two controls, the play/pause