Currently I am trying to accomplish with Cocos2d-swift+SpriteBuilder and their tutorial provided there
I am trying to do this not in Objective-C but in Swift. So during the tutorial I have faced with the issue when Xcode can't find CCBReader.
As I can see from the project structure, it is in place. The place where I stuck is:
var ball: CCNode = CCBReader.load("Bird")
In the tutorial this line looks like:
CCNode *ball = [CCBReader load:#"Bird"];
The main problem is that I can't get access to the CCBReader while it presents in the libs.
Could someone help me with this please?
This issue was fixed by Cocos2d-Swift 3.4beta + SpriteBuilder 1.4.
http://forum.spritebuilder.com/t/spritebuilder-1-4-beta-release/2573
Related
I used to use the userDistanceToManeuverLocation variable from the RouteStepProgress Class but this seems to just return nil recently.
Just in case I was doing something wrong I tried following the MapBox iOS nav tutorial (https://docs.mapbox.com/help/tutorials/ios-navigation-sdk/) but this had the same result.
Going by the MapBox tutorial I would do the following to get the variable:
let navigationViewController = NavigationViewController(for: directionsRoute!)
let distance = navigationViewController.navigationService.routeProgress.currentLegProgress.currentStepProgress.userDistanceToManeuverLocation
I don't seem to see any error messages or other concerns. I would get this variable on every tick of the users location but now just returns nil. Thanks for any help
So after some testing I figured out the issue is to do with the newer versions of MapBox Navigation (SDK MapboxNavigation). Anything from version 0.29.0 onwards causes issues. For now I'm sticking with version 0.28.0 and will have to report this to MapBox
Edit:
It looks like the latest version (MapboxNavigation 0.38.0 at the time of writing this edit) appears to provide a solution. I now use distanceRemaining found in the RouteProgress class which does the same thing.
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
Sorry - I realise this is a complete beginner question, but I've googled for half a day now and still can't resolve the issue myself.
I'm using xCode 8.3 and trying to complete the apple - app development with swift course - end of unit project 2. I'm told (by the Apple book) I should be able to run the app without build failures, even if it isn't finished.
I get an unresolved identifier error when I add the following code to my ViewControler file, inside the class ViewController: UIViewController.
func updateUI() {
correctWordLabel.text = game.formattedWord
scoreLabel.text = "Wins: \(totalWins), Losses: \(totalLosses)"
treeImageView.image = UIImage(named: "Tree \(currentGame.incorrectMovesRemaining)")
}
xCode suggests I change it to Game.formattedWord, but when i do get 'Instance member 'formattedWord' cannot be used on type 'Game' ViewController.Swift'.
Could someone please help?
I've checked the sample code from Apple about 100 times and they are def saying it should be game.formattedWord in the code.
Thank you!
Try correctWordLabel.text = currentGame.formattedWord
I think it’s a typo.
Earlier in your code you create an instance of the Game struct called currentGame so you are accessing the formattedWord variable inside that instance. That’s why you couldn’t change it to Game. Game is like the blueprint of the struct. currentGame is your actual ‘thing’ Hope that makes some sense.
I'm developing iOS app that handles .csv file with CHCSVParser in swift.
in Objective-C, the initialization code goes like this.
CHCSVParser *p = [[CHCSVParser alloc] initWithContentsOfCSVFile:[inputFileURL path]
so in swift, I think it goes like
var p = CHCSVParser()
p.initWithContentsOfCSVFile(path)
but this code leads error "CHCSVParser does not have a member named 'initWithContentsOfCSVFile'".
BridgingHeader file works fine.
func parserDidBeginDocument(parser: CHCSVParser)
this delegation method successfully calld after p.parse() .
Does anyone please help me? What should I do?
Any advice appreciated. Thanks in advance.
Swift does an automatic conversion of Objective-C constructors and removes "initWith". So in Swift, it is like this:
var p = CHCSVParser(contentsOfCSVURL: path)
In cases such as this, I recommend just typing the first part:
var p = CHCSVParser(
an then taking a look at what Xcode autocomplete suggests.
Had anybody done analytics with ComScore on iPhone? I am not able to understand how to start it. Can anyone help me in this please? - objective-c.
One can find answer here in this here pdf i used it for android.
The init method for ComScore is:
[CSComScore setAppContext];
But I believe you can also use:
[CSComScore start];
// Or...
[CSComScore startWithLabels:#{#"label1":#"value1"}];
And to track view changes/appearances:
[CSComScore view];
// Or..
[CSComScore viewWithLabels:#{#"testLabelA2":#"testValueA2", #"testLabelB2":#"testValueB2"}];
Be sure to look at the ComScore.h header file for the full list of methods used by their library.