CFBundleCopyResourceURL returning NULL

Discussion in 'iOS Programming' started by neil.b, Nov 20, 2008.

  1. neil.b macrumors member


    Nov 20, 2008

    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!


  2. neil.b thread starter macrumors member


    Nov 20, 2008
    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:
  3. wizard macrumors 68040

    May 29, 2003
    XCode is very buggy!

    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!

  4. neil.b thread starter macrumors member


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

    Thanks for the input - at least I know I'm not going totally mad. :)
  5. priyank.ranka macrumors member

    Jun 11, 2008
    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.
  6. caveman_uk Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    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:

Share This Page