The top line of code is the suggested autocomplete provided by Xcode, which doesn't compile. The bottom piece of code has been modified with code provided here
Firebase with Swift ambiguous use of observeEventType
Everytime I type this code out i have to modify it, which is tedious. Why is the autocomplete wrong? It is not just for this .observe, but all of them.
It seems like your Firebase framework is not the latest version?(as the latest one is now supporting the Swift 3 syntax).
Try pod update.
Related
I am completely new to iOS or Mac development, and I am trying to implement opening and reading files in an app for MacOS. By default I had my app use SwiftUI. Looking up how to implement such a functionality using SwiftUI I saw suggestions to use UIDocumentPickerViewController. However I cannot find a proper documentation as to how to use it in practice. Apple's documentation page is not informative at all -- it doesn't provide any information as of how to actually use this class.
Trying to follow some examples I found elsewhere on the Internet, I am now stuck with getting Cannot find UIDocumentPickerViewController in scope compilation error. I have tried importing UIKit, AppKit, CoreServices, MobileCoreServices, Cocoa but nothing seems to help -- extending the class as described in another StackOverflow answer just fails with the same compilation error.
How do I properly use UIDocumentPickerViewController, or how do I implement the same functionality using some other method if this one is wrong?
Apparently UIDocumentPickerViewController is not available when building for Mac OS X, and NSOpenPanel seems to be a way to get the necessary functionality.
I am trying to create a directory in my OS X app. The method was suggested as I started typing. But the method seems to be incorrectly suggested. The attributes parameter of the method in NSFileManger normally takes a [FileAttributeKey:Any] dictionary, but here in the suggestion it takes a [String:Any] library.
I checked the NSFileManager APIs and I could not find any like this. Can anyone explain what is happening here?
Your deployment target or your Xcode version is old. FileAttributeKey is new.
https://developer.apple.com/documentation/foundation/fileattributekey
I'm new to coding, so help is appreciated. I'm getting the error, "expected declaration- in extension of AFError". I'm not sure what I'm doing wrong. It looks right to me. What do I do?
While trying to change the syntax from Swift 2 to Swift 3 the converter destroyed the code of your Alamofire Framework. Always use the correct Framework Versions and don't try to update the code yourself. Also when running the converter, always just run in on your own code. Not on the code of Frameworks.
I'm using cocoa pods and map box was working fine but I installed an update and this message appeared:
Now I can't run my project. I'm using map box iOS sdk 3.3.4. What should I do to fix this issue?
According to apple documentation:
The Swift compiler automatically imports Objective-C code as conventional Swift code. There may be edge cases in your code that are not automatically handled. If you need to change the name imported by Swift of an Objective-C method, enumeration case, or option set value, you can use the NS_SWIFT_NAME macro to customize how a declaration is imported. See more.
So all what I did was delete the implementation of the NS_SWIFT_NAME and with that I was able to build the project. I don't know what made this error appear but this was the best solution I found.
Example:
From this:
- (instancetype)recordWithRPM:(NSUInteger)RPM NS_SWIFT_NAME(init(RPM:));
To this:
- (instancetype)recordWithRPM:(NSUInteger)RPM;
I'm trying to make an app with swift/Obj-c (Bridging Header) with parse.com
So here's my question:
I saw on many sites that you can use Parse.setApplicationId("appid","clientid")
When I try this code it says Use of unresolved Identifier 'Parse'
I imported the framework and set the bridging header in the properties.
I also imported the frameworks which are required like it's written on parse.com
All other Classes/Objects from parse can be used by swift in the code.
This problem was because of a bug in xcode... (I think the compiler failed)
After I restarted Xcode the error was gone.