I have been running a BDS Minecraft server in windows. I now want to move my and my friend’s world to Realms. I took the level folder out of the worlds folder and put it in the minecraftWorlds folder on my iPad using iFunBox. I made a copy of the world to test with. While the world is the same, I have lost my inventory. How can I preserve my and my friend’s inventories?
The "local" player inventory is separate from remote player inventories. You don't need to worry about your friends encountering this problem provided your account owns the realm as they will always be "remote" players and have their inventory match up.
I have not tested whether uploading a world file where you are a remote player to a realm owned by you would give your player the same problem or whether realms is smart enough to reconcile the inventories. An easy work-around is simply to dump your inventory into a chest, save and quit, then upload the world.