1

what am i doing wrong?

i'm trying to open a midi file and read it's contents. so far i can open the file in playgrounds but i get "Open::fopen failed" in my project

override func viewDidLoad() {
    super.viewDidLoad()

    let path = NSURL.fileURL(withPath: "/users/me/file.mid")
    var midfile: MusicSequence?
    NewMusicSequence(&midfile)

    MusicSequenceFileLoad(midfile!, path as CFURL, .midiType , .smf_ChannelsToTracks)
}

i do have import AudioToolbox and CoreMIDI

EDIT: some progress I'm able to open midi files from bundle with CFBundleCopyResourceURL, but i want to be able to open files from anywhere in finder

fileManager also fails, it returns nil when used inside a project and works in playgrounds.

Mec Os
  • 131
  • 1
  • 8

1 Answers1

0

figured it out.

code fails because the app runs sandboxed and the NSURL can't be accessed

Mec Os
  • 131
  • 1
  • 8