About loading assetbundle in iphone

when i create a assetbundle and put it in the application.data path in iphone manually,then in the code ,i use the www to load the assetbunld, but it just return the error “load assetbundle fail” and the www.assetbundle is null.can anyone help ,thanks.
i just use BuildPipeline to create the assetbundle.and the code is ok on windows and mac platform.

and i print the www.error msg ,it is “bad URL”.but i can download the file from web browser.
//the console message as below:
//my assetbundle url to load by www

file:///Users/ios/Library/Application Support/iPhone Simulator/4.1/Applications/ABF0D1D0-F88B-41BC-883F-601BC0BC50D1/demo3.app/Data/…/AssetBundles/CharacterElementDatabase.assetbundle

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhoneSimulatorPlayerUnityLib/UnityEngineDebug.cpp Line: 34)

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhoneSimulatorPlayerUnityLib/UnityEngineDebug.cpp Line: 34)

Failed to load asset bundle

(Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/Misc/AssetBundleUtility.cpp Line: 185)

bad URL

It looks like the url you are trying to use is a local path on your computer:

file:///Users/ios/Library/Application Support/iPhone Simulator/4.1/Applications/ABF0D1D0-F88B-41BC-883F-601BC0BC50D1/demo3.app/Data/../AssetBundles/CharacterElementDatabase.assetbundle

This will of course not work on your iPhone.

Hi, I’ve a similar problem. This local path seems fine to me.
Usually with native iOS you load file with NSURL url = [NSURL urlWithString:@“file://…/Documents/filename”];

var urlFile = "file://" + GetiPhoneDocumentsPath() + "/savedassetbundle.assetbundle";
Debug.Log("---> loading file from: " + urlFile);

downloadFile = new WWW (urlFile);

yield downloadFile;

var	assetBundleFile  = downloadFile.assetBundle;
if(assetBundleFile==null)
{
	Debug.Log("---> file not found");
	return;
}

On Unity this doesn’t works… does anyone knows why?

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";