Search Unity

Unable To Open Archive File IOS

Discussion in 'Asset Bundles' started by Brandgage-1, Sep 27, 2018.

  1. Brandgage-1

    Brandgage-1

    Joined:
    Nov 15, 2017
    Posts:
    32
    Hello.
    The following code snippet works fine in Editor and in Windows Builds.
    Whenever I try to put a build onto an IOS device, I receive the error "Unable to Open Archive File:......".

    What I have already done is:
    Confirmed that the asset bundles were built for IOS.
    Confirmed that the path was correct (Although System.IO.File.Exists and System.IO.FileInfo.Exists both returned false for the filePath variable).
    Confirmed that the folder and files "Raw/AssetBundles/AssetBundleName" exists in the xcode project.

    The only thing that I am checking now is that the "literature.elitID" is sure to be lower case in the filepath as they are lowercase as an assetBundle. That is in a build currently being built so I will update this with the results.

    Aside from that I have no clue why it is not loading.


    Code (CSharp):
    1.         string bundlePath = Path.Combine(Application.streamingAssetsPath, "AssetBundles");
    2.         string filePath = Path.Combine(bundlePath, literature.elitID);
    3.  
    4.         var assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(filePath);
    5.  
    6.         if (assetBundleCreateRequest.assetBundle == null)
    7.         {
    8.             Debug.Log("The asset bundle is null!");
    9.             pageProcessesCount--;
    10.             yield break;
    11.         }
    12.         yield return assetBundleCreateRequest;
    13.         assetBundles.Add(assetBundleCreateRequest.assetBundle);
    14.        /code]
    15.  
    16.  
    Thanks to whoever may be able to help!

    EDIT: So after changing the elitID to lowercase, File and FIleInfo were able to find the files. As for after that, I was not able to continue the application as it seems to get caught up on loading the Asset Bundles (No unable to open archive error was thrown). But I just was not able get my scene to the expected view). Added more debugs in my code to see where the issue is during the loading process. I will do another edit when that happens

    EDIT 2: That did not seem to work, I assume it might be getting caught up in Async Operations and it's just too much to handle. So I am going to test load it synchronuosly using AssetBundle.LoadFromFile and see if it gets caught up again.
     
    Last edited: Sep 27, 2018
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    you are checking for null before the load completes. it is always null there
     
  3. Brandgage-1

    Brandgage-1

    Joined:
    Nov 15, 2017
    Posts:
    32
    Luckily, that is not the case. At that point it located and referenced the asset bundle, but does not have its contents loaded at that point.

    The problem was the Async operation was too much for the iPad's memory to handle so it just got stuck there, for a looong while. Not even sure if it ever finished.

    Just changing it to a non-async method worked perfect, just no cool loading circle while it happens.