# Issue loading banks in Xamarin for iOS

**URL:** <https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620>\
**Category:** FMOD Engine\
**Created:** [April 8, 2020, 8:23pm UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620 "2020-04-08T20:23:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danieldpperry](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@danieldpperry](https://qa.fmod.com/u/danieldpperry)\
**Post date:** [April 8, 2020, 8:23pm UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620/1 "2020-04-08T20:23:22Z")

</div>

I’m hoping I can get a little help with the problem I’m having.  
I’m using Xamarin and currently just focusing on the iOS side.  
I was able to build properly with the non-logging lib of FMOD, and initiating a system and generating a default setting utilizing the Unity general implementation approach with adaptation.

When loading a bank,

> ```
> LoadedBank loadedBank = new LoadedBank();
> FMOD.RESULT loadResult = Instance.studioSystem.loadBankFile(path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank.Bank);
> if (loadResult == FMOD.RESULT.OK)
> {
> loadedBank.RefCount = 1;
> Instance.loadedBanks.Add(path, loadedBank);
> Debug.WriteLine("Loaded bank " + path);
> if (loadSamples)
> {
> loadedBank.Bank.loadSampleData();
> }
> }
> 
> ```

LoadResult is OK, but when I check after that:

> system.getBank(bankName, out bank);  
> bank.getLoadingState(out FMOD.Studio.LOADING\_STATE loadingState);

**loadingState results in UNLOADED, and the events are failing to show either.**

Some troubleshoot confirmation:

- I am using the path to the .bank file (not the .string.bank), and confirmed the file size is approx. as expected (using FileInfo(path).Length), so the file is definitely where i’m directing to.
- I also confirmed that if I give an incorrect path the library doesn’t give OK on result.
- Before adding the file to the build this way, I did an assembly add with file stream, and tried to load the file using the loadBankMemory method, with similar result, so I assume the system is not properly set, rather than the iOS file read is faulty, but documentation is sparse on initialization and I’m overall following the unity RuntimeManager initialization so I assume I’m covering most cases.

Does anyone have thoughts as to why this would happen? what could possibly prevent loading the bank?

Thanks,  
Daniel

---

<div class="post-metadata">

**Author:** ![danieldpperry](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@danieldpperry](https://qa.fmod.com/u/danieldpperry)\
**Post date:** [April 11, 2020, 8:22pm UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620/2 "2020-04-11T20:22:46Z")

</div>

I was using version 2.00.08, but just tested on 2.00.03, and issue is still present.

---

<div class="post-metadata">

**Author:** ![danieldpperry](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@danieldpperry](https://qa.fmod.com/u/danieldpperry)\
**Post date:** [April 13, 2020, 2:51am UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620/3 "2020-04-13T02:51:24Z")

</div>

Problem identified, and is currently solved, but leads to more questions.

More information:  
Changed the library to Logging library, and now I’m getting more insight.  
skipping all init log since it looks ok, and isn’t relevant as far as I’m aware.

Running this several times with a button for testing:

> Debug.WriteLine(“Running LoadBank”);  
> RuntimeManager.LoadBank(bankName, true);  
> Debug.WriteLine(“Post LoadBank”);

> Produces the following debug:  
> Running LoadBank  
> [LOG] Manager::readBank : fileversion = 125, compatVersion = 119 (oldest = 44, newest = 125)  
> [LOG] Manager::finishLoadBank : Bank with guid {395b5d46-968f-4e6f-a4d3-fb79714905c7} has already been loaded

Meaning the library is loaded, but does not resume the code that follows LoadBank. I assume this is because some sort of inside FMOD bug that forces return or breaks something.

The other problem I identified is that the events do not retain their name on a mobile build in my FMOD project for unexplained reason. However, referring to them directly from their GUID works. Not ideal if I had a lot of events, but in this case it’s tolerable.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [April 19, 2020, 11:53pm UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620/4 "2020-04-19T23:53:23Z")

</div>

In the Unity Integration, the `RuntimeManager.LoadBank` function doesn’t attempt to load a bank that has already been loaded but instead increments a ref count.

> [@danieldpperry](#):
>
> The other problem I identified is that the events do not retain their name on a mobile build in my FMOD project for unexplained reason.

To be able to use names/strings to refer to events and other objects, the strings bank/s need to be loaded beforehand.

---

<div class="post-metadata">

**Author:** ![danieldpperry](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@danieldpperry](https://qa.fmod.com/u/danieldpperry)\
**Post date:** [April 20, 2020, 6:49pm UTC](https://qa.fmod.com/t/issue-loading-banks-in-xamarin-for-ios/15620/5 "2020-04-20T18:49:01Z")

</div>

Truely, however I’m pointing out that the Debug.WriteLine(“Post LoadBank”); is not running, and its breaking the continuation of the rest of the code coming forward.

Now that I know that I can go around it, but it forces some quirky coding.

The other note that I mention is that for the loaded bank when running

> tempBank.getEventList(out FMOD.Studio.EventDescription eventDescriptions);  
> foreach (var desc in eventDescriptions)  
> {  
> counter++;  
> desc.getPath(out string path);  
> desc.getID(out Guid id);  
> Debug.WriteLine(counter + " " + path + " with guid " + id.ToString());  
> }

The path is empty for some reason.  
Loading the event using the GUID straight out of FMOD studio works fine. Not ideal, but usable and working.
