Xcode making thousands of copies of app - ios

I'm not sure what this problem is related to. I have an iOS app I have been working on for about a year in Xcode. It works beautifully when testing locally in simulator or on devices. I tried emailing the whole folder to a developer today and holy smokes! the app folder size is 29 GB!! So I investigate and see that the app is apparently creating copies of itself again and again inside folder after folder. Each folder has all the files of the app plus a folder that has the files of the app and so on....
It may be related to Dropbox as well, as I attempted to link the main app folder to Dropbox a while ago. I looked in my Dropbox account but there's only one folder there (with date modified not showing).
I am afraid of breaking my app as well if I start deleting stuff, although I do think that the active one I am opening is the most top one when I go to the app in Xcode.
What could be causing this?
Please see attached screenshot:

Related

Possible to extract game files from ios app?

I recently deleted some of my key IOS game files in Xcode by accident. Before deleting the said files, I uploaded my IOS game to my iPad as a test and it worked. I still have the working app on my iPad but I don't have the necessary files to run the game on my mac. Is it possible to extract the Xcode game files, that I lost, from my working game app on my iPad, and then add them into my Xcode project so that my game is restored?
The files that I lost took me many hours to program and it would be very helpful if I could find a way to retrieve them. Thanks!
Whilst it's possible to access files inside your applications documents folder, it's not possible to retrieve Swift source files or indeed .sks SceneKit files, as they are compiled into the .app bundle.
You can download the app container and see what's salvageable though.
For information on how to do that, check out this answer.

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

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 )

Is there any way currently to browse an App Folder / App Sandbox on an iOS device with iOS 9

As a developer doing many operations with files in my own apps' sandboxes (An app's subfolder environment such as Documents folder etc.) on the device, I found it extremely useful to be able to browse my app folder to see if my code was writing things to the correct places etc. I always used to use iExplorer for this & it was vital. To my horror, I came to do the same browsing today, only to find that you can no longer look inside the app's folders with tools like iExplorer. Some research tells me that as of iOS 8.3, Apple have placed restrictions which stop these tools from doing the great job they did.
Is there a work-around now at the iOS9 stage or even any tools that still manage to do it? This was so essential as a dev.
I'm assuming you mean a physical device, not the Simulator. In that case, you could open the Devices window (Xcode > Window > Devices) and then select the relevant device on the left.
In the Installed Apps section, select your app, and then click the gear icon which will give you a menu to Show, Download or Replace Container...
Now, it's available FileBrowser to browse the content of an app folder (in its sandbox).

Having a bit of trouble with copying a local file on iOS

Having only worked with Android/web dev before I am having a hard time figuring out where in the world my file should be getting copied to in iOS. After reading the file browser documentation on the iOS developer resource page it says that each app is an "island" which contains its own folder system. If I want to have my user be able to copy a file from my app's sdk to their iOS device, where should I put it?
I downloaded a file browser app from the app store on my iOS testing device but am I right in thinking that there is no global file browsing system?
I am using a Cordova plugin called Asset2sd which works perfectly for me in Android, getting the root storage folder and downloading the file to there. It has no iOS alternative so I'm going to have to figure something else out, I just need to know where to start. Do I have to have the user access my app's internal files somehow? Can I create a folder for them to look in when they download my app? Some documentation or something would be wonderful. I am totally lost.
Thanks!
You're right. Apps don't have access to the global file system. Each app only has access to their own app directory. Here's in-depth information on Sandboxing: https://developer.apple.com/app-sandboxing/
In your app's sandbox, you basically can manage files as you want, i.e. download, copy, move, delete, etc. So you can create a folder Downloads in your apps documents directory and then display the contents of this folder for instance in a table view.
Related documentation/links:
https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/index.html
https://stackoverflow.com/a/6907432/967327
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/iPhoneAppProgrammingGuide.pdf

Resources