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

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...

Related

How to use "responseDecodable" method in Alamofire?

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
...
}

os_log - use of unresolved identifier error

I'm trying to use the new os_log API, by logging a simple statement:
os_log("Hello")
And I get an error for os_log:
Use of unresolved identifier 'os_log'
I also tried wrapping it in a block, like this
if #available(iOS 10.0, *) {
let foo: StaticString = "Something happened."
os_log(foo)
}
And I still get the same error. I would like to use this in Swift 4.
I looked for possible frameworks that might be required, and found no likely candidates.
I found no solution from these links either:
https://developer.apple.com/documentation/os/logging
https://developer.apple.com/videos/play/wwdc2016/721/
Because you forgot to
import os
at the start of this file.

Argument Labels '(_: RSKImageCropMode:)' do not match any available overloads

I'm trying to use RSKImageCropper library in swift (Library written in Objective-C).
I encounter the below error in my ViewController.swift file (see image).
Could someone please suggest how I could resolve this issue ?
You are too close to solved this you need to combine your comment code and current error getting code. So you need to initialized RSKImageCropViewController like this way.
let imageCropVC = RSKImageCropViewController(image: image, cropMode: .circle)
/access the imageCropVC

Swift 2 - Visualizing an AVMutableComposition for Debugging : Converting Apple's AVCompositionDebugViewer

I'm running into an issue with my swift 2 conversion of an Apple provided example for displaying an AVMutableComposition. This is a really useful project if you're trying to visualize your AVComposition to see what might be going on under the hood.
Update: I added print statements to each function to see the order they are being called, and who is calling them, in comparison to the Obj-C project.
Two Issues that I'm seeing that seem pretty important:
synchronizePlayerWithEditor() is not getting called after buildTransitionComposition(_:andVideoComposition:andAudioMix:)
observeValueForKeyPath(_:...) is NOT being called in the same order as the Obj-C project
Posting the snippet here to get the calling function as it's kind of useful
Obj-C
NSLog(#"%d %s %#", __LINE__, __PRETTY_FUNCTION__, [[NSThread callStackSymbols] objectAtIndex:1]);
Swift
func functionnYouWantToPrintCaller(yourNormalParameters..., function:String = __FUNCTION__){...}
print("\(__LINE__) \(__FUNCTION__) \(function)
Here is Apple's AVCompositionDebugViewer project I'm working from: https://developer.apple.com/library/mac/samplecode/AVCompositionDebugViewer
My github repo:
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift
I think the issue might be stemming from something in the keyValueObservation code although I'm not entirely sure at this point.
The issue ended up being in SimpleEditor.swiftbuildCompositionObjectsForPlayback` method. There were some global variables that were being defined incorrectly.
Everything seems to be working as expected now.
https://github.com/justinlevi/iOSAVCompositionDebugViewerSwift

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