How can I see data inside an iOS app from Xcode? - ios

An iOS app is supposed to remove all data when a user logs out of the app. This has been completed, but I am looking for a way to verify that there is no data left over in the app (SQLite, user preferences, etc.)
I cannot figure out how IO can link to the app from Xcode (or from somewhere else and "look" into the app after a user logs out and confirm that all data is gone.
Bryan

I cannot figure out how IO can link to the app from Xcode (or from somewhere else and "look" into the app after a user logs out and confirm that all data is gone.
You can download the directory that contains all the app's data:
Open the Devices and Simulators window in Xcode and connect to the device you want to examine.
You'll see a list of the apps that you've installed on the device. Find the one you're testing in the list and click on it.
Click the gear icon at the bottom of the list and choose Download Container....
Xcode will download a bundle named something like com.your.identifier 2018-12-17 14/18.28.448.xcappdata.
Find the downloaded bundle (you can choose where Xcode puts it) and control-click on it. Choose Show Package Contents. Finder will open a window showing you everything in the app's container.
In addition to just looking at the app container, you can also modify the container and install it on a device. This can be useful for testing. For example, you could modify or delete an important data file from the container and install it on a test device to test that your app gracefully handles an error situation. Or, if someone testing your app runs into a problem you can't reproduce, you can get a copy of the app container from them and install it on your own device.

Related

Access other .ipa's files installed on my iphone via my app

Can I access other .ipa files present on my iphone via my app and pass it to the backend server.
Will I be able to do that after jailbreak? If not on a non-jailbroken device.
The short answer is NO.
Other than that you can register the app as an app that works with different file types and the user can open them manually. Take a look of different App Extensions types Document Provider and Share.
You can't get exact IPA file.
You can get it's container from XCode if it is your app, In container you will found document directory of app where you might have saved data to get this
Goto xcode -> Device And Simulator -> Select your Device -> choose Application
Press Setting button on bottom and press download container

transfer my own app from device to xcode

I have built an ios app which I have tested successfully on my ios device. Since last build Ive had to rebuild my laptop and as such Ive lost my xcode project. Is there a way I can transfer the app from my device back into xcode?
The way you are getting your thing is totally different. However you can recover some part of your project data like images, what framework you have used etc.
First you need to connect your device with your system, then open iTunes and select your app then download that app. Now you have to click on that app see option for Show In Finder and click it
If you see your .ipa file, then make it a zip of it and then unzipped it, a payload name folder will appear on your screen. you will see appName.app, right click on it and select show package contents. This will show the app package contents. You can recover few data from that. But if you are thinking to recover code level data then it is not possible.
And you need to make a backup of your project whenever you make any updations so that any accident happened does not affect your main project.
No that´s not possible to do... Next time use Source Control such as Git for example to keep track of your code and prevent this happening in the future (that´s one of many benefits of source control).

How to access Xcode database from iPhone app

This is my first iPhone app. I'm using Xcode 7.3.
In the app I used this tutorial to create an sql database using the app (when the user gives permission by pressing a button, it creates the .db file).
Now I would like to know how I can download the database from the app.
Here is why:
The app will be downloaded on someone's device (not via the app store). It is supposed to collect data from a wearable device and store it in the database.
However I don't know how to access that data later on when I have the user's phone. Apparently the db lives in
/var/mobile/Containers/Data/Application/###/Documents
I read that one method is "jailbreaking." But I have never done that and this is not my phone I'm dealing with, it's a client's, so I don't feel comfortable hacking it. Is there another way? Possibly through the terminal (this is how I did it with the android app, using adb)?
Or is there another way I can go about saving the database so that it is accessible/retrievable?
The first answer is correct but incomplete :
Once you have download the Container, the extension is .xcappdata, so you need to right-click on it and select show the package.
Then browse into /library/Application support/ to find your database in .sqlite
You can try to connect the device to your Mac, then in XCode, go to Window, Devices, select your device and app bundle and click "Download Container...".
To see the database, you could use SQLite.

Install ipa from my server in a jailbroken device with out user interaction

I need to install my application(.ipa) in a jailbroken device with out user interaction.
This installation has to be triggered by an other application which is already installed in that device.
My .ipa is in a sever, So is it possible to install through itms:// or is there any jailbroken alternative available
I want to install this app silently (with out MDM), there should not be "Install" "Cancel" alert popping for the user to select.
Let me know if there is a possibility of achieving this through %hook.
Solution to my above question
Each step below has literally 100 more steps internally. If you are not familiarized with jailbroken apps/tools development, this is going to be a nightmare. Sorry, I cannot share code since I did it for a client. but stack overflow has answers for how to do the various components i mentioned below separately. once you do a little POC on separate components, my answer will help you to put them together.
This will work only in jailbroken devices and cracked ipa files
Create a daemon application.
make sure it runs 24/7 in background.
To trigger installation from server, add socket.io(or any other
similar framework) to the app (since daemon app is running always,
make sure the socket connection to the server is also always alive)
Send the URL of zipped ipa file to daemon app via socket.io server.
In the daemon app, unzip the .zip to .ipa
once it is unzipped there are two ways you can install the app.
easy way is to unzip .ipa further to .app and move .app folder to the
applications folder in iPhone.
There is a private springboard api, which takes ipa file path as
input and installs it
If you cannot crack the ipa
This is way more complex than above :) you have to run a code which opens AppStore, Search for the application and install it.
same as above upto step 3
Manually(for POC) record the coordinates of all the button clicks inside AppStore required to install any app in general. like click on search tab at the bottom, select the search bar, insert text in search bar, click on search button, click get/install button from result....
create a dynamic library which takes those coordinates as an input and do a uiautomation. inject this dynamic library into AppStore.
from the server, send this coordinates to your daemon application, which will pass on this coordinates to dynamic library and open AppStore from background.
once AppStore is opened, beauty of dynamic library is, it will kick in automatically and start you ui automation.

Get database from crashed iOS app

I develop an iOS app and I send it to any beta tester. After 2 month app has a crash and now it doesn't work .
I need to get any information about log or better I need database. How can I get it ? I can connect to my Mac, but I don't know how to access to db data (if is it possible).
It's very important get database information.
Thank you.
In your device, you can access support directories only for applications compiled for development.
Connect your device to your computer. Having launched xcode, open 'Organizer' window (Window->Organizer). On the left hand side of the menu you will have your device displayed. Under your device, select 'Applications'. All the dev applications will be available there. Select the application you are interested in and click 'Download' at the bottom of the window. What happens - the support directories are downloaded. They are stored in bundle with extension '.xcappdata'. 'ctrl' click on the file and menu will give you an option 'Show Package Contents'. You will find there your sql database file.
You can either use XCode Organizer to download the application directory from the device, or if the tester is remote ask them to install a program like iExplore that lets you simply copy application directories off of the device to send to you.

Resources