views:

380

answers:

2

Hello,

I'm working with the ID3 framework in Xcode (which has since disappeared off the face of the web - including google cache!).

I'm testing out an import mp3 feature which allows them to edit the tags as they import them. One of the test cases is a corrupt or invalid mp3 with no proper id3 header. The problem I'm having is that when updating the tags of the invalid mp3 (updateFile:), the ID3 framework attempts to use id3V1Tag.m (I assume it falls back to this if it can't find the v2 tag) and this is where I get the Xcode error (whilst running the program, not building):

Xcode could not locate source file: id3V1Tag.m (line: 299)

Even in a release build this crashes the program, so it's not something I can really ignore.

I've tried putting a try/catch block around it but it's not treated as an exception so doesn't get caught. The function to load the tag data for the file returns a BOOL but it appears this only returns false if the given file doesn't exist, so this doesn't help either.

Current code:

[tagData release];
tagData = [[TagAPI alloc] initWithGenreList:nil];
tagsLoaded = [tagData examineFile:exportPath];
if(tagsLoaded) {
    [tagData setTitle:title];
    [tagData setArtist:artist];
    [tagData setComments:comments];
    @try {
        [tagData updateFile];
    }
    @catch (id e){
        NSLog(@"h");
    }
}
A: 

So the problem you're having is that your program is crashing when you attempt to compile id3V1Tag.m or while running the program. I'm a bit confused on that.

If its crashing while running maybe this is an issues with a code file missing from a library? How are you reading the ID3 tag information exactly? Is it through your own code or through a 3rd party library/class.

Rob Segal
It crashes during the running of the program, specifically when calling updateFile:. The ID3 tags are read through a third party library which I think is missing this file since I've not touched the files themselves since downloading them.
Septih
That would make sense. Oddly enough I ran into this exact same error over the weekend. If I recall correctly the problem was as you stated. The implementation file was missing. Do you have a file named "id3V1Tag.m" in your project? If it is already included you may want to try removing it from your project and re-adding it.
Rob Segal
Right, I did a spotlight search and found the .m file in the original download, so added it to the framework and found it threw a bad access exception (although this didn't trigger the catch in my original code). I added breakpoints to the function but it didn't hit them. Removing it and adding it again didn't make a difference.
Septih
Shouldn't have to do this but another possibility would be to copy all the code from those files you need and paste them into new files you create in your project.
Rob Segal
+1  A: 

The error you're getting is that Xcode is trying to locate your source file id3V1Tag.m in order to show it during debugging. No code you write will affect this.

If you don't have the id3V1Tag.m source file in your framework distro, there's nothing you can do about this, and there's little to do but ignore it (other than seeing if you can avoid causing it to be requested, like not setting a breakpoint in it, not stepping into it, and not crashing in it).

If you do have it, and are building it, then perhaps you're not building with the right debug information, so you'll have to tell us more about your build setup.

cdespinosa
To clarify: The app has already crashed. That message appears when Xcode tries to help you debug the crash; it comes from Xcode, not the ID3 framework (which is not part of Xcode and does not come with the Xcode Tools), and is not the cause of the crash.
Peter Hosey
I don't have the file, so not a lot I can do there. The method seems to take it upon itself to call the missing file, and is the only method that I can see in the framework that will save the tags, so I can't get away with not calling it. I would quite like to just ignore it, but it crashes the program, so I can't. If the try/catch picked up the crash it would be fine, obviously it won't because it's not an exception, but is there not another way to emulate the try/catch behaviour (I don't care about crash/error details)?
Septih
It's not the *method* that's calling the missing file. The code is crashing. Xcode is trying to be helpful by showing you the source code of the crashing method, but you don't have it -- that's essentially what the warning is saying.The primary problem here is that your code is causing the framework to crash. The warning about a missing file is just an after-effect; you should be concentrating on eliminating the crash itself.
cdespinosa
Right, I get you now. I'll go see if I can get the framework debugging properly.
Septih
Managed to get the gdb working on the framework and it turned out I just assumed wrongly that it would handle null strings for tag values. Thanks for the help.
Septih