WWW fails to load assetbundle in iOS

I’m having problems to get an assetbundle, I already build it with the iPhone target so that should not be the problem.

My method looks like this

        public static string AssetBundleURL
        {
            get
            {
                if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
                    return Application.dataPath + "/assetbundles/";
    			else if(Application.platform == RuntimePlatform.IPhonePlayer)
    				return "file://" + Application.dataPath + "/Raw/assetbundles/";
                else
                    return "file://" + Application.dataPath + "/../assetbundles/";
            }
        }

I start the simulation and I get the following path:

“file:///Users/dev/Library/Application Support/iPhone Simulator/5.0/Applications/E01747A0-F487-4415-825B-6095FDCBEE6E/rb.app/Data/Raw/assetbundles/ios.assetbundle”

I already checked if the file was on that path… and it’s there but for some reason www gives an error != null when I print it… then I get bad URL

Any idea?

Ther is already a question about this:

http://answers.unity3d.com/questions/163421/about-loading-assetbundle-in-iphone.html

I found this really helpful, hopefully others looking here will too:

http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/

It is possible to get access to files in the XCode project by first getting Asset.DataPath, and traversing the directory one level to files within the root of the xcode project, eg:

"file://" + Application.dataPath + "/../Packaged_iOS/" + bundleGroupNames[type] + ".unity3d";