Osstatus Error Code -34018

OSStatus error 2003334207 while re-buiding the App from Xcode 6

Under iOS8, the path that you have saved won't be valid across launches. The id you see "410AB24E-5FB0-4401-AC59-3C03D676E951" will change with each launch.

The solution is to save the filename and not the complete path, and to recreate the URL or complete path, by getting the path to the Documents (or tmp) folder and appending the filename to it.

What is OSStatus?

As you've said, it's the result code of the function.

Hovewer, different functions have different result codes that you can handle as you wish. for example, for Audio services, the current OSStatus codes are give in the documentation as:

Sample Image

So as you call your functions, you check the returnes OSStatus and if it's noErr (which is what 0 is), then you can continue with your next call, otherwise you handle the error accordingly.

OSStatus error 2003334207 when using AVAudioPlayer

It looks like your trying to unwrap a variable that has a nil value. You should safely unwrap your variables to prevent this.

if let data: CDEpisode = fetchedResultsController.objectAtIndexPath(indexPath!) as! CDEpisode
{
var err: NSError?
let url = NSURL(string: data.localPath)
println("The url is \(url)")

//rest of code
}

You will still need to figure out why it is returning nil but this is a safer way to unwrap variables and prevent crashing as there would need to be more context to resolve that issue.

Some questions to look into:

  • Are you sure the fetchedResultsController is returning an object at
    all?
  • Are you sure it is of CDEpisode?

audioSession error: The operation couldn’t be completed. (OSStatus error -50.)

Your code has some structural problems. I've cleaned it up a bit for you:

class ViewController: UIViewController {

var audioSession = AVAudioSession.sharedInstance() // we only need to instantiate this once
var player : AVAudioPlayer? // making this a property means player doesn't get released as soon as playSomething exits

@IBAction func playSomething(sender: UIButton!)
{
if let ringURl = Bundle.main.url(forResource: "ring", withExtension: "m4r")
{
do {
try audioSession.setCategory(AVAudioSessionCategorySoloAmbient)
try audioSession.overrideOutputAudioPort(.speaker)
} catch let error as NSError {
print("audioSession error: \(error.localizedDescription)")
}

do {
let ourPlayer = try AVAudioPlayer(contentsOf: ringURl)
ourPlayer.prepareToPlay()
ourPlayer.play()
self.player = ourPlayer
} catch let error as NSError {
print(error.description)
}
}
}

If you're still seeing a "-50" error, make sure your .m4r file is being included in your built application. I was just looking at a related question regarding this a few minutes ago, so the answers there might help you too.

iOS Xcode 10 Simulator Error (OSStatus error -600)

Restart the computer (not just Xcode). Then go into Library / Developer / CoreSimulator / Devices and throw everything in the trash. Then launch Xcode, go into Devices and Simulators, and delete all simulators from the Simulators pane. Now create one simulator in the Simulators pane. You will be able to build and run on it.

EDIT The OP reports that even this was insufficient to clean out the problematic dead simulators. It was also necessary to say xcrun simctl delete unavailable in the Terminal.

OSStatus error 1718449215

1718449215 is the decimal representation of the four character code for the kAudioFormatUnsupportedDataFormatError error.

In general you can use something like this to get more information from the errors you receive:

NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain
code:my_error_code
userInfo:nil];
NSLog(@"Error: %@", [error description]);

Getting error code -10670 when running a Mac Catalyst app in Xcode

The problem is solved with new Mac OS 11.0 Beta (20A5374g).

If your catalyst app has multi-window support, you may still need to kill your existing app before launching the new one.



Related Topics



Leave a reply



Submit