How to use "responseDecodable" method in Alamofire? - ios

I have been trying to use "responseDecodable" method from Alamofire, but I'm getting "Generic parameter 'T' could not be inferred" error while using it.
Can someone guide me how to fix this?

As you can read in the documentation, using responseDecodable is straightforward:
AF.request(...).responseDecodable(of: ResponseType.self) { response in
...
}

Related

'init()' is deprecated: Use init(configuration:) instead and handle errors appropriately

I am writing a code for a Sentiment Analysis using Swift, but I get this error
('init()' is deprecated: Use init(configuration:) instead and handle errors appropriately.),
when writing this line of code:
let model = SentimentsClassifier_1()
Why is this happening and how can it be fixed?
Thanks!
Don't know how to solve this yet...

What is the missing parameter in TaskState<TResult> in Bolts-Swift?

In the Bolts-Swift framework Task.swift, upgrading to Swift 4 produces this error for this method:
class func emptyTask() -> Task<Void> {
return Task<Void>(state: .success())
}
The error states:
Missing argument for parameter #1 in call
I understand that it's saying .success needs to take a parameter but without posting the entire file in here for context, can anybody with Bolts-Swift experience identify why this used to work in Swift 3 but doesn't work now using Swift 4?

Use of literal for Objective-C is deprecated error from AWS DynamoDB framework

I'm having issue with AWS DynamoDB framework. XCode is giving me warning on the following line :
var model: AWSDynamoDBObjectModel {get set}
// This lines gives me "Use of literal for Objective-C ...
if (model.classForCoder.respondsToSelector("rangeKeyAttribute")) {
.....
}
I tried to fix that issue by repeleacing with this line :
if (model.classForCoder.respondsToSelector(Selector("rangeKeyAttribute"))) {
and seems that Selector is also depreciated in Swift 2.3.
Any idea how to get rid of this warning?
Use #selector syntax. It's the modern way.

Updated Parse SDK, getting " 'init()' is unavailable" for PFFile

I just updated the Parse SDK and I'm getting a bunch of errors now. Where I declared "var myIcon = PFFile()", now I'm getting an error that says " 'init()' is unavailable". Anyone encounter this, how do I initialize these variables? Thanks in advance!!
You have to initialize a PFFile instance with some data. You can use any of the class methods found here.
For example, PFFile(data: YOUR_NSDATA)

Xamarin iOS Binding: Could not initialise an instance of the type, returned nil

I've bound an iOS library, SVGKit, to C# using Xamarin/Monotouch. After some issues I've managed to get the library to build ok.
My code can be found here: https://github.com/jamesmundy/SVGKit.Xamarin
Unfortunately, when I try to initialise a type from the class I receive the following error:
Could not initialize an instance of the type
'SVGKitBindings.SVGKFastImageView': the native 'init' method returned
nil. It is possible to ignore this condition by setting
MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
The full stack trace is can be seen here.
Any idea as to what is causing this problem and what I can do to rectify it?
Update: Here is the full Build Output of my project. http://pastebin.com/f60wFm52
Update 2: Tried setting SmartLink to false and rebuilding, same error though a slightly different build output. http://pastebin.com/ApCAz2BP
Look at the source code for SVGKFastImageView init [1]:
- (id)init
{
NSAssert(false, #"init not supported, use initWithSVGKImage:");
return nil;
}
The managed exception is correct: you can't call this constructor.
[1] https://github.com/SVGKit/SVGKit/blob/cd47ae95e57c9490a9238173855ecbe83d4aaf44/Source/UIKit%20additions/SVGKFastImageView.m#L53

Resources