XCode UI Testing: Can I use UI Testing scripts to access the documents directory of the target app? - xcode

I am testing an iOS app using XCTest Framework. I have to access/read projects from the Documents directory of the target app. Since XC Framework installs itself as a separate app on the simulator, I cannot access the directory as the app runs in sandboxed environment. Is there any way to access the directory apart from uploading the files on Cloud storage or using shared storage by making a common App Group (both of these options do not look feasible as the project size is too large and the Common App Group method seems to be complicated)?

Related

Xcode 8 - changes to where Core Data/Sqlite Database are saved?

Xcode has always saved the Core Data/Sqlite database files of any given App in that App's Documents folder - by default. But has that just gotten changed in Xcode 8?
I just created a new Core Data App (in Xcode 8.1) and after running the App I couldn't find the usual three sqlite files in the app's Documents folder. Instead, and after much digging around, I discovered those sqlite files in the App's Application Support folder, which is located inside that app's Library folder.
Is this a bug? Or is this the new thing now?
I thought that if we wanted to persist data in an iOS App, the data had to be written into the Documents folder - and that calling saveContext() did just that, automatically.
Anyone know what's going on?

Cleanest way to upload image to S3 from Mac OS X app?

I have been trying to find an easy solution to upload a small image (500px) to S3 from a Mac app I am building.
The mac app is an OS X version of an iOS app I have already built. The only interaction I need to have with AWS is to upload images so I am just looking for the best practice method for doing this.
Is creating a PHP script to do the job on the EC2 instance the best way to go about this since there isn't an AWS SDK for Mac?
I have created an OSXified version of the iOS SDK here. I have added a scheme to build only the modules (AWSCore, AWSCognito and AWSS3) you need for S3 interactions. Once you build, locate the Products directory in finder and you should see the 3 .framework files you will need to add to your OSX project.
From that point onwards it is the same as using the iOS library, instructions for which are provided here (Getting started with Swift/Objective-C sections).
When using in your own project make sure you add a build phase for copy files and add these frameworks there. Lastly turning on codesigning will prevent you from having to interact with Keychain Access everytime you run your app.

sandboxing an existing OSX app

I have an existing OSX app that supports OSX 10.5 onwards. I want to publish it to the AppStore and therefore I need to sandbox the app. I guess sandbox app should be supporing 10.7 onwards.
The app uses a folder in the username directory to create temp files etc
It also copies a sql db file which already has empty tables to the same temp folder and upates records as the app is used.
Furthermore if there is a crash it picks up logs from the crashlog folder of osx and requests user to submit them to developer.
Question
with a sanbox app, where do I store temp files ?
Where should I place the db file which can be read/witten to + new App update should be able to find exsting db file.
Should the custom code for crash reporter be kept or be made redundant ?
Thanks
where do I store temp files ?
In the directory recommended by NSTemporaryDirectory(). (This applies to both sandboxed and non-sandboxed applications.)
Where should I place the db file which can be read/witten to
In your application's Application Support directory. Use NSSearchPathForDirectoriesInDomains() to find it, then append your application's name. Again, this is the same whether you're sandboxed or not.
new App update should be able to find exsting db file.
Not possible. You can ask the user to locate the existing file with a NSOpenPanel, but you can't open it yourself, because it'd be outside your sandbox.
Should the custom code for crash reporter be kept or be made redundant ?
You'll need to remove it, because it won't work under sandboxing — crash reports are not stored to your sandbox. You will receive crash reports for your application through iTunes Connect.
Alternatively, you may want to look into a third-party crash reporting service like PLCrashReporter.
There is a mechanism to migrate the data of an existing App into the sandbox: Migrating an App to a Sandbox on developer.apple.com
This is done once the newly sandboxed app is launched the first time. If you can determine where the database was stored, you can migrate it into the sandbox.

Can someone view html files of a WP7 application after downloading it from the marketplace

I'm new to developing applications using phonegap and windows phone 7.
I learnt that while an application is running in the emulator, we can use Isolated Storage Explorer tool to retrieve the application's local folder. From the copy of the local folder, we are able to see files like index.html and other html files of application.
My question here is: When someone downloads my application from marketplace(developed using phonegap and WP7), will they be able to see my html files using Isolated Storage Explorer in any way?
You can use something like WP7 Root Tools to do the same thing as the Isolated Storage Explorer.
The Applications folder in the root contains the Data and Install folders, from which you can access isolated storage or the installed files and DLLs for any installed app. Note that this requires root access, but it can be done.

Bundled content in an app store app

I am trying to get my app submitted to the mac app store and I am having a bit of a design problem. Our app is an authoring tool and comes bundled with many projects created with the tool. Before the time of the app store, we would ship our app as an .img file which contianed a project directory and our app. Since I am only going to be submitting the .app file to the app store
with my app I am wondering where I should but the projects directory.
Initially I tried to put the projects directory inside of the bundle but this will not work because it is possible for the user to make changes to projects which might add new files to the project directory and this would make the sandboxing unhappy and mark the app as invalid.
What is the correct place to store such resources? I assume they should go inside the container? If so, what would be an elagent way to deploy this projects directory? Since we do not have installers in Apple land what would be the best place to deploy this projects directory? Do I just need to check on app launch if the projects are present and if not copy them from the bundle? This seems wrong.
Do I just need to check on app launch of the projects are present and if not copy them from the bundle?
Actually, this sounds right to me. As you said, the user cannot change/add any files in the app bundle. If you have resources there that the user needs to interact with, I would copy them to the ~/Library/Application Support/MyApp/ folder when they are needed. The user can then interact with the files from that location. (When sandboxed they go into a different but related location.)
I don't really know what your app does, but it would also seem like a possibly useful feature to "reset" the project files/folders back to a starting state. So copying the files in this way would allow for that kind of behavior as well.

Resources