View Full Version : CFBundleCopyResourceURL returning NULL

Nov 20, 2008, 09:32 AM

I'm trying to make a simple sound player for my application and am having trouble getting the URL of files using CFBundleCopyResourceURL.

My app (so far) consists of a delegate and a view controller plus my own custom class for a sound object (just a NSObject that will play sounds). My view controller instantiates the sound object.

If try to load sounds in the sound object with CFBundleCopyResourceURL (to get the sound file URL) it returns NULL. If I move the code (to get the sound file URLs) to my view controller, it works.

The only way I can get the sound object to load the sounds is to have the view controller get the URL with CFBundleCopyResourceURL and then pass the resource URL to the sound object, which is messy as I'd rather have the sound object take care of all of it's loading needs.

Is there a scope/access issue with CFBundleCopyResourceURL? It's driving me mental!



Nov 20, 2008, 02:30 PM
Sorted it.

I'd renamed one of the files and it seems Xcode hadn't internally recognised that it had changed. Removed the resource and re-added it to the project.

Odd, but it works now. :rolleyes:

Nov 20, 2008, 02:40 PM
Not to flame the thread but XCode is very buggy. I've had to reinstall once to eliminate a very strange issue. Thing improve slowly but the latest release seems to be a bit better. In any event I've had issues with Python editting, recognition of files, crashes, script handling and other stuff.

I hate to say this but XCode is a good example of the general decline in Apples software quality. I do wish they would get their act together. Hopefully Steve is talking straight when he says that is part of the goals for Snow Leopard!


Nov 20, 2008, 04:05 PM
I'm beginning to realise that :(

Thanks for the input - at least I know I'm not going totally mad. :)

Mar 5, 2009, 02:13 AM
Is there any way through which i can store the sound in application to the phone and also use it as ringtone. Thanx for the advice in advance, will look forward for ur advices...i really got stuck with this issue for my release.

Mar 5, 2009, 02:18 AM
The iPhone SDK builds of xCode used to crash randomly a bit too often for my liking but it does seem to have got quite a bit better on the 2.2 releases - at least for me. Some things still seem to be part science part voodoo though:rolleyes: