xcode9-beta

Error copying files with FileManager (CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme)

假如想象 提交于 2019-12-23 07:21:58
问题 I'm trying to copy some (media) files from one folder to another using FileManager 's copyItem(at:path:) , but I'm getting the error: CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme Error Domain=NSCocoaErrorDomain Code=262 "The file couldn’t be opened because the specified URL type isn’t supported." I'm using Xcode 9 beta and Swift 4. let fileManager = FileManager.default let allowedMediaFiles = ["mp4", "avi"] func isMediaFile(_ file: URL) -> Bool {

Error copying files with FileManager (CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme)

我的未来我决定 提交于 2019-12-23 07:21:11
问题 I'm trying to copy some (media) files from one folder to another using FileManager 's copyItem(at:path:) , but I'm getting the error: CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme Error Domain=NSCocoaErrorDomain Code=262 "The file couldn’t be opened because the specified URL type isn’t supported." I'm using Xcode 9 beta and Swift 4. let fileManager = FileManager.default let allowedMediaFiles = ["mp4", "avi"] func isMediaFile(_ file: URL) -> Bool {

Ambiguous use of play of MPMusicPlayerController in iOS11, swift4

陌路散爱 提交于 2019-12-23 03:51:59
问题 I'm running the Apple iOS11 example Adding Content to Apple Music on Xcode Version 9.0 beta 3 (9M174d) . I get a Ambiguous use of 'play() in /adding-content-to-apple-music/AppleMusicSample/Controllers/MusicPlayerManager.swift:78:9: Ambiguous use of 'play()' The suggested solutions to explicitly define the selector in order to avoid the ambiguity like: let play = #selector(musicPlayerController.play) did not work in this case. The MPMusicPlayerController instance in the MusicPlayerManager

How to place 3D model using ARKit iOS 11 with some custom background view without using camera?

六月ゝ 毕业季﹏ 提交于 2019-12-23 02:36:05
问题 I am working on an Augmented Reality iOS app for which i am using ARKIT of iOS 11 beta. I am using ARSCNView(SceneKit) to render my .scn object. I have followed the sample given by apple in order to create an ARSession(https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip). Is it possible to place the 3D model with custom background instead of camera? Like user can select the background color or can provide custom 2D photos as background? 回答1: Your view has a scene property

Xcode 9 borderColor doesn't work in User Defined Runtime Attributes

橙三吉。 提交于 2019-12-23 01:38:30
问题 I'm using this CALayer extension: var borderUIColor: UIColor { set { self.borderColor = newValue.cgColor } get { return UIColor(cgColor: self.borderColor!) } } I thought that maybe because of this extension my borderColor of the Submit button from the bottom of the page doesn't change to white (as I want it to be): But no, I hooked up an IBOutlet and tried to set directly the color like this: submitButton.layer.borderColor = UIColor.white.cgColor Did it in viewDidLoad , viewWillAppear and

Programming a UIButton is not working in Swift 4 Xcode 9 Beta 6, Cannot add target

不想你离开。 提交于 2019-12-21 07:14:11
问题 In the past I had no problem creating a UIButton programmatically, but ever since I've been using Xcode 9 and Swift 4, I cannot find a way to make this error go away. //Adding target to UIButton func PositionStartButton(xOffset: Float){ StartButton.frame = CGRect(x: Int(0 - 40 + xOffset), y: 0, width: 80, height: 80) StartButton.setImage(#imageLiteral(resourceName: "Logo_Final_WHITE_Face"), for: .normal) StartButton.addTarget(self, action: "pressButton:", for: .touchUpInside) ScrollView

Code migration from Swift 2.x to Swift 4

只愿长相守 提交于 2019-12-20 09:50:53
问题 We have big enough project which is built up with Swift 2.x and now Apple has just released Swift 4 so to move forward for latest version of Swift which path we can choose... Do we need to migrate our code to Swift 3 first? Or we can directly migrate our code to Swift 4 using Xcode 9? 回答1: Yes, you must migrate your code in Swift 3 compatible version. Xcode 9 allows conversion/migration from swift 3.0 only. Swift 3.2 is supported by Xcode 9 & Xcode 8 both. Convert your source code from Swift

Xcode 9 Beta - editor, column selection gone?

亡梦爱人 提交于 2019-12-20 05:23:07
问题 In previous versions of Xcode, we could hold down Alt/Option key, drag the mouse to select columns in the text editor. In Xcode 9 Beta this doesn't seem to work. Is this gone now, or is it a different key combination? Any ideas? 回答1: According to the Xcode 9 release notes it is a missing feature. I can only assume it will be added back in before the official release. From the Xcode 9 Release Notes (page 21): Xcode 9’s new source editor does not yet support discontiguous or columnar selection.

iOS11 UIBarButtonItem action not get called

会有一股神秘感。 提交于 2019-12-19 06:17:31
问题 I used Xcode9 Beta6 to build the project, the action was called correctly on iOS10 device, however it is not work on iOS11 device. In My project, there are some viewControllers have a UIToolBar on the top, and the toolBar contains some UIBarButtonItems. There is one this kind of viewController, whose UIBarButtonItem action is not called when I tap the UIBarButtonItem. I can see the tapping animation (the icon become dim first and back to normal after finger released) At the end of viewDidLoad

Overlapping accesses to 'urlComponents', but modification requires exclusive access

妖精的绣舞 提交于 2019-12-19 05:21:05
问题 I am trying to use the Lyft API with iOS 11 and Swift 4, and am receiving an error on the second line, which is Overlapping accesses to 'urlComponents', but modification requires exclusive access; consider copying to a local variable. I am unsure what this means, and how I can get around it. Any help is appreciated, thanks! let queryItems = parameters .sorted { $0.0 < $1.0 } .flatMap { components(forKey: $0, value: $1) } var urlComponents = URLComponents(url: mutableURLRequest.url!,