Using LSO (Local Shared Objects) within iOS Development and Calling File Back Up - iphone

I am developing a app for iOS using Flash, and I've created a LSO using the following code:
var so:SharedObject = SharedObject.getLocal("name");
so.data.user = enternamehere.text;
var result:String = so.flush();
I'm using a input text field so that users can enter their name. The instance name is "enternamehere".
I'd like to be able to call the information stored from the input text to appear on a different scene within the file.
So, a user enters their name on scene 3, and it appears on Scene 4 and the name is stored locally.
Any way of doing this?
Thanks

Related

cant change class resource at runtime godot

im making a project for listening to episodes of a podcast as if they're real cassettes. The idea is that some info about the episode shown on the cassette model + it's audio file are stored in a class, then before putting the cassette in the player, being able to change the class resource the cassette takes from with buttons. My problem is that it doesnt let me change it on runtime, just set it on the ready function.
The way the cassette script loads the data:
onready var data = preload("res://MAGs/Season1/Ep1.tres")
The way im trying to change it:
func _ep_select():
data = load(<different cassette's data>)
If its impossible to change it on runtime, what should i use instead of this?

URL updated for GeoAnchors in RealityKit with anchor info after being removed from ARView

I'm using GeoTrackingExample project from Apple:
GeoTrackingExample
and there is a bug in the logic where after you reset the AR Session, it still retains the anchor information in the URL. So the steps are as follows:
start app
tap in the arview and place an object
select Reset AR Session from the menu
tap in the arview to place an object
select save anchor from the menu
save file to device
Reset AR Session
Load the saved file
When the file loads, it will load both the initial object placed in the AR view in step 2 then removed in step 3 and the added object that was placed in step 4. It should only have saved the object added in step 4, not both objects from step 2 and 4. When stepping though the code to debug, it appears that the the anchors are removed from the ARview but somehow the URL will contain the path for both the anchors. What else do I need to do to clear so that objects from previous sessions are not added to the URL in the current session? Is the URL modified when the object is added to an ARView? Please help! Thanks
The example code from Apple uses a computed var to store the array of placed Geoanchors in the scene but since the computed variable is read-only, the values in the array cannot be removed when the scene is reset so it was keeping a long list every time a model was added to the scene with no way to delete them (that I know of.) Fixed the issue by not using a computed variable and modifying the code accordingly:
var currentAnchors: [ARAnchor] = [] // from
var currentAnchors: [ARAnchor] {
return arView.session.currentFrame?.anchors ?? []}
append the geo anchor to the array when the anchor is placed in the scene
add currentAnchors.removeAll() in the reset AR session function
Not sure if this is helpful at all to anyone out there but I'm glad I figured it out!
** Anyone know why they used computed variable for storing AR Anchors?

How to temporarily save user input data in swift?

I have three ViewController two of them have images and TextFields to input from user, and the third one is to display the first and second data and save it .
How can I temporarily save data entered from the user and when the user finishes all the required steps, a summary of the data is called for viewing and then uploaded to the firebase database?
I'm using Swift 4
Define a struct that can hold all of the data the user can enter and that eventually needs to be persisted.
Pass an instance of this struct from view controller to view controller where each controller populates which ever fields it is responsible for.
After the last screen, the struct will contain all of the data. Process it as needed.
The above assumes the user will complete the whole process in one use of your app. If you need to support the ability for the user to start now and finish later (and the app could be killed and restarted in the middle), then this basic idea still works but you need to add code to encode/decode the struct to/from a file. Make your struct Codable and use PropertyListEncoder/Decoder.
all type of Data store in UserDefaults
Like - Float , Double, Int , Bool, URL ...
Description here
UserDefaults.standard.set("Value", forKey: "key")
Get Value
UserDefaults.standard.string(forKey: "key")

Preloaded Core Data Storage in Swift 2.0

I am currently making an application in Swift. I was looking into Core Data to store the little bit of data I actually need to store. I want three (permanent number) of these objects stored within the phone at all times.
class Location {
var name = ""
var type = ""
var address = ""
var distance = ""
init(name:String, type:String, address:String, distance:String) {
self.name = name
self.type = type
self.address = address
self.distance = distance
}
}
These are locations of a sort that users can save within the app. Then they can click a labeled button that will load the text fields with the stored data. The user can update them from time to time if they need to. The issue is not how to save within Core Data or fetch it. The question is, how can I have these Entities/Attributes already stored into the app before anyone even runs / downloads it? I figured I could just create these saved locations at start and flag it whether or not this is the first run to eliminate the duplications. But shouldn't there just be a way to build the objects into the program from the start and just manage them from then on? Or is there an entirely different method I am over looking?
I have never used Core Data but it seemed like the way to go from the tutorial book I am reading. It, along with online resources, just state how to build and maintain Code Data from scratch. I could not find how to build a library in and manage it instead.

How to delete a file while the application is running

I have developed a C# application, in the application the users choose a photo for each record. However the user should also be able to change the pre-selected photo with a newer one. When the user changes the photo the application first deletes the old photo from the application directory then copies the new photo, but when it does that the application gives an exception because the file is used by the application so it cannot be deleted while the application is running. Does any one have a clue how to sort this out? I appreciate your help
This is the exception
The process cannot access the file
'D:\My
Projects\Hawkar'sProject\Software\Application\bin\Debug\Photos\John
Smith.png' because it is being used by
another process.
//defining a string where contains the file source path
string fileSource = Open.FileName;
//defining a string where it contains the file name
string fileName = personNameTextBox.Text + ".png" ;
//defining a string which specifies the directory of the destination file
string fileDest = dir + #"\Photos\" + fileName;
if (File.Exists(fileDest))
{
File.Delete(fileDest);
//this is a picturebox for showing the images
pbxPersonal.Image = Image.FromFile(dir + #"\Photos\" + "No Image.gif");
File.Copy(fileSource, fileDest);
}
else
{
File.Copy(fileSource, fileDest);
}
imageIDTextBox.Text = fileDest;
First of all, you code is not good.
The new image is only copied if there is currently no image (else).
But if there is an old image, you only delete this image, but never copy the newer one (if).
The code should better look like this:
if (File.Exists(fileDest))
{
File.Delete(fileDest);
}
File.Copy(fileSource, fileDest);
imageIDTextBox.Text = fileDest;
This code should work, but if you are getting an exception that the file is already in use, you should check "where" you use the file. Perhaps you are reading the file at program start. Check all parts of your program you are accessing these user files if there are some handles open.
Thanks a lot for your help and sorry for the mistake in the code I just saw it, my original code is just like as you have written but I don't know maybe when I posted accidentally I've put like this. when the application runs there is a picturebox which the image of each record is shown, that is why the application is giving an exception when I want to change the picture because it has been used once by the picturebox , however I've also tried to load another picture to the picture box before deleting the original one but still the same. I've modified the above could if you want to examine it