Where are FoneMonkey saved scripts stored? - ios

I'm using FoneMonkey to test my app.
When I save a script, I can see it's directory in the log, but it is wrong: There is no such path as .../Users/Name/Library/Application Support/iPhone Simulator/4.3.2/Applications/5B286FB6-D58E-4D43-947D-3B63591289BB/Documents
I can't even find iPhone Simulator folder on my Mac... How is that? Where can I find my scripts?

the Library folder in user directory is hidden. unhide it or user the terminal to get there.

Related

How can I access the contents of a folder selected from Files app?

Basically my app works like a iCloud-based note app (for example, logseq). Users first select a folder in Files app, then my app starts downloading/updating the contents of the folder.
So I implemented folder selection via UIDocumentPickerViewController, after I got the folder path in Files app. I tried downloading a hardcoded file like (<the folder path user just selected>/fileList.json) via FileManager.startDownloadingUbiquitousItem, got 257 permission error (the file does exist in my icloud drive). Then I followed the answer from this answer to call startAccessingSecurityScopedResource. It always returns false and the same 257 error returned.
Perhaps, I cannot access a random file from a selected folder? but how can those note apps work by simply letting users selecting a root folder?
Answering my own question after some debugging. Call startAccessingSecurityScopedResource on the folder path you grabbed from picker, not its subfiles. After that, you can start downloading its subfiles via startDownloadingUbiquitousItem

Where can I find the xcresult logs from my application in an Xcode UI Test?

On running a UI Test, I can see the .xcresult file generated in ~/Library/Developer/Xcode/DerivedData. I have some NSLogs in my application that I need to display as well. Does anyone know where is the path to get the application log or xcresult file?
The path your Xcode project's xcresult files as of Xcode 14.1 is
/Users/USER_NAME/Library/Developer/Xcode/DerivedData/APPNAME-SOME_XCODE_ID/Logs/Test/Test-SCHEME_NAME-DATE.xcresult
So if your username is gran_profaci, your app name is MyAwesomeApp, your scheme name is AwesomeScheme and you live in timezone UTC-5 your path would look something like this:
/Users/gran_profaci/Library/Developer/Xcode/DerivedData/MyAwesomeApp-aiupaskztadstnnevejnfigoiug/Logs/Test/Test-AwesomeScheme-2022.11.21_09-39-19--0500.xcresult
Each test you run will create a new xcresult file with the corresponding parameters and current date.
You can directly open the DerivedData folder from Xcode by clicking on the icon displaying a right arrow inside a circle:
If you want to extract information you can use the xcparse command line tool, in your example to export the logs:
xcparse logs /path/to/Test.xcresult /path/to/exportLogFiles
the path most likely appears on the terminal
/Users//Documents/P/ios/build/<>/Logs/Test/Run-<.....>.xcresult

How do I put content into the iOS Documents folder at compile time, using Xamarin?

I have a data file that I need to include with my app when I distribute it. When loading any files in the app, I prefix the file name with:
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
This works great for anything I create within the app (and for reading back), like files I download in response to a user action. But I can't for the life of me figure out how to place files there when I build my app in Visual Studio.
I've tried making a "Documents" subdirectory in the special "Resources" folder, but that didn't work (I tried setting the "Build Action" to both BundleResource and Content). When I look at the folder for my app (from using the simulator) I can see that in the "Documents" folder there's all the files I downloaded, but I can't find my data file that I'm trying to bundle ahead of time. I even searched my entire hard drive on the Mac and still couldn't find said data file.
The data file isn't an image, if it matters. Just raw binary data. How do I set it up so that this file goes into the proper documents directory at compile time, so that I can read it using the SpecialFolder.MyDocuments prefix? Thanks.
You can't. You can include files in your app bundle, and then at startup copy them from the bundle into a user folder. But this won't happen automatically.

How to make Xcode Iphone Simulator save SQLite database to local file?

I am building my first iPhone app with CSS, HTML, Javascript and PhoneGap. I want to use SQLite as the database, so i am using the following tutorial as inspiration:
http://coenraets.org/blog/2011/10/sample-app-using-the-phonegap-database-api/
The following code determines weather to use data from the database, or to populate the database with data first:
function onDeviceReady() {
db = window.openDatabase("EmployeeDirectoryDB", "1.0", "PhoneGap Demo", 200000);
if (dbCreated)
db.transaction(getEmployees, transaction_error);
else
db.transaction(populateDB, transaction_error, populateDB_success);
}
After debugging, i found out that every time i run the app, it populates the database, so
if (dbCreated)
never executes.
I want to have a look at the SQLlite file, so i am using SQLite Database Browser to locate it, without luck. From the following question:
How to view the data in sqlite file running in iphone application?
I can see that the file should be located somewhere in this folder:
user/Library/Application Support/iPhone Simulator/
But the iPhone Simulator folder does not exist.
How do i make the simulator save the database to a local file?
Each time you run your application on simulator, it creates a folder inside iphone simulator folder .Make sure your Library folder is visible and you are using the correct path.
To make library folder visible you can run the following command on terminal:
chflags nohidden ~/Library
Here`s the path for my iphone simulator folder to use as a reference:
/Users/alexandreoliveira/Library/Application Support/iPhone Simulator
Another thing to notice, usually the sqlite database get saved inside documents folders:
Users/alexandreoliveira/Library/Application Support/iPhone
Simulator/5.1/Applications/some-weird-numbers/Documents/

iOS application update problem with files in documents directory

Oddest issue, thought I would see if anyone had run into this before.
We have an iPad application that stores PDF files in the documents directory. All goes great, we can open the PDF's with CGPDFDocumentCreateWithURL all day long. Then, we reinstall the application from the same adhoc site, and for some reason are not able to load the files. We can iterate the documents folder, see the files there, but can't open them. We just get a nil back from CGPDFDocumentCreateWithURL.
This feels very much like the permissions on the files change after the update, but can't prove that.
So, has anyone encountered this post update? Is there anyway to get a error return from CGPDFDocumentCreateWithURL?
We encountered a similar problem recently and perhaps the same is happening to you.
Are you using the complete URL/path which you had (probably) saved before you updated the application.
The reason is that the App_Home directory changes on updates. So if earlier it was:
/var/mobile/applications/<guid1>/
after the update it will become
/var/mobile/applications/<guid2>/
The solution is to save relative paths from App_Home directory.

Resources