Download .rcproject from remote and place it in AR view? - ios

So, I'm following the documentation and created a composition with Reality Composer. There is a step in the docs called Add the Composition to Your App, what I would like is to add the Composition to my app dynamically. Upload the file to a server and download it from a URL.
In the tutorial, it says that when importing the .rcproject it generates a code
Xcode automatically generates code that you use to manipulate the stored objects. For example, Xcode generates a class for the scene based on the scene’s name (MyGreatScene) inside an enumeration based on the name of the project file (MyProject.rcproject). As a convenience, it also provides a loadMyGreatScene() method
Is there a way for me to generate this code downloading it from my url? Should I upload another file to be able to download it?

Related

Add remote USDZ file to local RealityKit .rcproject file and display in QLPreviewController

I'm using AR Quick Look. I have a Reality Composer scene (.rcproject) in my project. I'd like to add a variety of entities to the .rcproject, define triggers and actions AND add a USDZ file from a file at run time.
I can load a remote USDZ file into a QLPreviewController and display it fine as the single QLPreviewItem. I have the URL, covert it to a local file then open it as a preview item.
There are lots of examples of adding entities to an ARView.
But I do not see how I can have a scene defined in Xcode (.rcproject), that I edited with Reality Composer, add a entity (e.g. USDZ file) at run time and display the revised reality file using QLPreviewController and QLPreviewItem.
I can Entity.load(contentsOf: url) to load the .rcproject scene, get the anchor and add a child, which is the USDZ file I got from a remote URL and converted to a local file, but then how do I save that back (the updated anchor or ???) to a .reality file and pass the temporary local file URL as a QLPreviewItem?
Or is there a way to add an entity (USDZ file) to a running QLPreviewController view at run time?
I'm trying to stay with QLPreviewController because I need users to be able to share this AR Quick Look view with other iPhone users so they can open the view in Safari on the iPhone without needing my app.

Upload files using umbraco data type

I want to create a custom data type or better reuse an existing one that allows me to upload a file (pdfs or images) on a specific folder (in an Umbraco 7 site) not related to media folder. Any ideas on how to do this?
You'll want to create a new property editor (Tutorial) to create the view of the datatype and let the angular code call a UmbracoAuthorizedApiController (Documentation) to do the uploading of the file

Upload file to the specified path (OneDrive)?

I prefer iOS code but the solutions in other languages may refer to this question too.
I use LiveSDK to access to OneDrive. Here is a link to the example which uses upload action (onClickUploadButton:)
But I can't understand how to specify the custom upload path - only default "me/skydrive" works. How do you solve the problem when you need to upload a concrete file to a concrete path which may not exist? Should I create all the folders separately and/or get their IDs to place a file exactly into them?

How to access uploaded files from views

All the uploaded files are stored under
__namespace__/src/__namespace/Controller/logos/file.jpg
and controller file returns only file name "file.jpg" in the view.
So how can I provide path to logo folder in my view in IMG tag
This is where you made the first "Error"! Never store user-data inside your Modules!
When you have users upload data for your module, store them under /data/module-name/! That way you can easily access the files via src="../data/module-name/filename.jpg"
Alternatively, when you want to provide files with your Module and be able to use them, theres a great Module out there called AssetManager, which in turn uses Assetic.

iOS file browser example

Does anyone have some sample code demonstrating how to make a "file browser" view? I'd like to be able to navigate through directories and drill-down the sub-directories and see files located within the various folders. I want the user to be able to create new directories/files and even select an existing file. Is there sample code out there already available to do this?
I don't know about sample code, but this wouldn't be too complicated to achieve using NSFileManager and a UITableView.
You can obtain arrays of directory contents using the subpathsOfDirectoryAtPath:error and associated methods of a file manager. These arrays in turn can populate a UITableView. It would be fairly easy to put together a navigation controller that could display a series of table views showing a file hiearchy.
Bear in mind, however, that you'll only be able to access the directories inside your application sandbox, unless you're running on a jailbroken device.
The iOS programming guide says that
You should never present users with the list of files in this directory and ask them to decide what to do with those files. Instead, sort through the files programmatically and add files without prompting.
This is assuming you are trying to implement file browse feature for your documents directory.
I'm an author of FileExplorer which is a file browser for iOS and fulfills most of your requirements.
Here are some of the features of my control:
Possibility to choose files or/and directories if there is a need for that
Possiblity to remove files or/and directories if there is a need for that
Built-in search functionality
View Audio, Video, Image and PDF files.
Possibility to add support for any file type.
You can find my control here.

Resources