transfer my own app from device to xcode - ios

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).

Related

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

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.

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.

iOS File Retrieval - NSDocumentDirectory

I am working on a library with a very verbose logger module that, on iOS, writes xml logs to NSDocumentDirectory in a consistent file tree. I want to come up with a way for the user of this library to easily access these logs.
I know it is simple to programatically retrieve files from this directory, but is it possible to access this directory on an iOS physical device in any way from outside Xcode to retrieve these logs? I feel like I have seen it somewhere before, something in the manner of extracting the .ipa file and going into the package contents, but I could be wrong.
---------------------------------------------------------EDIT------------------------------------------------------------------
This (Browse the files created on a device by the IOS application I'm developing, on workstation?) is how to do it with Xcode on a device, but I have to assume that there is some way we can create that gets the logs off of a device for a user.
is it possible to access this directory on an iOS physical device in any way from outside Xcode to retrieve these logs?
It is possible to expose the Documents directory by enabling iTunes file sharing. When file sharing is enabled through this method, the contents of Documents directory would be visible to the user in iTunes, which can also be exported. The documents would also be visible for export through some third party desktop apps like iExplorer.
Here is the link to Apple documentation. You may also refer this thread to understand how this is done.
If you're using a simulator (apparently your task doesn't seem to need te real device) you are in luck.
You should go to a folder similar to this one:
/Users/[YOUR_USER_NAME]/Library/Developer/CoreSimulator/Devices/[RANDOM_HASH_YOU_SHOULD_DISCOVER]/data/Containers/Data/Application/[RANDOM_HASH_2_YOU_SHOULD_ALSO_DISCOVER]
Once there, with finder, you'll get the "documents" folder of the simulator and the app you're trying to retrieve your logs from.
You might say: I don't know which 2 RANDOM_HASHES should I go to.
Yes, you're right. If you have MANY simulators installed and or being used, it might be tricky to discover which one is the one you're trying to debug.
The same thing with your APP, your app will live in another RANDOM_HASH folder, and you should browse them, one by one, and then discover your documents folder.
Someone needed to solve this "mess" and created a Xcode Alcatraz Extension that leads you to the exact live simulator and APP you're debugging in any given moment, and then you don't need to guess which 2 random_hash paths you need to navigate to.
If Xcode + Alcartaz plugin extension manager is somewhat out of your reach, you might need to google it. It's not a difficult process.
PS: That magical Alcatraz Extension is named "XCodeWay" (in case you are brave enough to install Alcatraz onto your copy of XCode).
EDIT: Useful link to get Alcatraz: http://alcatraz.io/ Follow its easy instructions and you're done.
EDIT2: If Xcode cannot be used, then the last question in this other thread might come in handy: Browse the files created on a device by the IOS application I'm developing, on workstation?
(Still, an external application in your users machine will be needed )

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.

Get data from user test on device to mac

I'm doing some user tests of my new iOS app and store some test data in a plist. When I do that in the simulator it is easy to get that file for further analysis on my mac, but how can I easily get it from a real device? This will only be used during testing and will not be part of the final version.
Possible ways I have read about but not tried (in hope to get some directions here first):
E-mail attachment
Enable file transfer to iTunes
Jailbreak (but don't want to)
Currently what I am doing is to NSLog it and copy and paste from Xcode into Excel, but this requires that the device is tethered to my mac.
Any experience or advice on easiest way to get this done?
I sometimes use iPhone Explorer to do this, because the plist file I want is not in my Documents folder. I use it to navigate to the files associated with my app on the device. Just connect your device to your laptop, run iPhone Explorer and then use it to locate the plist file you want and drag and drop it wherever you want.
You can save data from Organizer. Just click on your device and it'll show in right pane. Files from documents folder and possibly other folders can be saved.

Resources