I am storing level details inside of a text file within my iOS project. The Text File contains the following:
Level1.txt
LevelNum:1.0
weaponPickupRate:10.0
weaponPickupAmount:20
monsterMinSpeed:8.0
monsterMaxSpeed:12.0
monsterRate:1.5
levelMonsters:10
goldPerMonster:10
I am reading the text file using the code below:
fileName = "Level1.txt"
levelPath = "\(NSBundle.mainBundle().resourcePath!)/\(fileName)"
var err: NSError? = NSError()
let s = String(contentsOfFile: levelPath, encoding: NSUTF8StringEncoding, error: &err)
println(s)
When I run this using the iOS Simulator - iPhone 6, everything works fine and it prints the data from the text file.
When I run this directly on my iPhone 6 it prints nil
and does not read the text file.
Why is this?
Cheers Ryann