Using SpeechKit for iOS using Swift - ios

I've used Nuance SpeechKit for some months using Objective-C. Now I'm coding in Swift - except for the class where I instantiate the SKRecognizer and SpeechKit has stopped working.
When I try to initialise the SKRecognizer object I get the following error:NMSP_ERROR] check status Error: 696e6974 init -> line: 485 makeFullPathname
Is it possible that it's because I'm using swift in the rest of the project?

Related

Does AudioKit 4+ support AKFrequencyTracker with Objective C?

I'm trying to incorporate AudioKit 4.0.3 (latest) into an existing iOS ViewController that's written in Objective C. I am having trouble initializing and using the AKFrequencyTracker class, even though other classes work fine (e.g. AKOscillator and AKMicrophone).
I added the following code to the ViewController viewDidLoad method in the Objective C example that came with it:
AKMicrophone *mic;
mic = [[AKMicrophone alloc] init];
AKFrequencyTracker *tracker;
tracker = [[AKFrequencyTracker alloc] init:mic hopSize:512.0 peakCount:20.0];
But I see an "No visible #interface for 'AKFrequencyTracker'" error in Xcode next to the last line.
It doesn't appear there are any init methods for AKFrequencyTracker. Any help would be greatly appreciated!
Due to a change with Swift 4 we need to explicitly add #objc to the init methods and forgot to do so with AKFrequencyTracker. I just fixed it in this commit:
https://github.com/AudioKit/AudioKit/commit/e9328d4aa8d76d0cae31eeb33b232abebd571d6e

objective-c use cocoapods add Swift framework not found file

I'm working on an objective-c project. I added a swift framework, which gave me errors.
When I touch "command" can find the file. When I use #import also can add "ChartLineView.swift".
But when I implement it as,
ChartLineView *cl = ....
I get an error, " Use of undeclared identifier LineChartView"
What could be wrong?
I guess your are having issue in importing swift library(added via cocoapods) in your Objective C project. Just go in your .m file and import the swift library like this.
#import LineChartView; // i suppose LineChartView is the swift library name.

How to define a CGPatternDrawPatternCallback in swift

Im trying to create a CGPattern using callbacks however the following method signature is not of CGPatternDrawPatternCallback type and I can not determine what it should be
func patternDefinitionFunction(#info: UnsafeMutablePointer<Void>, c: CGContext?)
You can't do this in Swift 1.2 or earlier; you'd have to write this part of your code in Objective-C. To write a C function in Swift, you'll need to update to Swift 2.0 (available in the Xcode 7 beta currently).

NSSet setByAddingObject in Swift 1.2

What is equivalent of setByAddingObject: in Swift. I have an NSSet property from Objective-C in Swift. But since Apple released Xcode 6.3 I have an error in this place:
Example:
NSSet *set;
object.set = object.set.setByAddingObject("text/html")
It produces error:
'Set<NSObject>' does not have a member named 'setByAddingObject'
Any idea, how to fix this? insert method doesn't work also.
Swift 1.2 added its own Set type, which is bridged over to Swift from Objective-C in a similar fashion to NSArray/Array and NSString/String. Try object.set.insert("text/html").

Parse SDK and Swift: Incorrect argument label in call PFObject 'withoutDataWithObjectId'

I subclass PFObject exactly as described here.
Then I create a new instance of the subclassed object without data, but since Swift 1.2 I get an error (It did work perfectly before):
var test = Armor(withoutDataWithObjectId: "1234567890")
-> Xcode complains:
"Incorrect argument label in call (have 'withoutDataWithObjectId:',
expected: 'className:')"
Why className? It should get the class name from the class function parseClassName
And I can under no circumstances create a new object with objectId but no data (which I MUST have to fetch it from the local datastore)
This is super annoying as my app doesn't compile any longer.
Update to the newest Parse SDK, available here.
The issue is caused due to necessary adaptions in the Parse SDK after the Swift language update. This issue also occurs with the most recent update to Swift 2.2. The newest (as of today) Parse SDK release 1.13.0 already fixes this.
UPDATE
Parse iOS SDK 1.13.0 has a typo and the function PFUser(withoutDataWithObjectId:) is called PFUser(outDataWithObjectId:). So upgrading the Parse SDK alone does solve this. Until this is fixed a temporary workaround would be to extend PFObject with a convenience initializer. To do this add a new Swift file to your project and insert this:
import Parse
extension PFObject {
convenience init(withoutDataWithObjectId objectId: String?) {
self.init(outDataWithObjectId: objectId)
}
}
It may be a little late to answer this question.
I use swift 1.2, and v 1.7.5 Parse SDK, and it works totally fine.
however, make sure you have define objective-c bridging header in "build setting".
and try to run it, even though there may reports some error

Resources