How to put file manually to iOS persistentDataPath? - ios

{to the point}
So I want to create some Quiz Game on Unity that the questions data using external file (in this case I using JSON). I want to keep my questions data can access/edit by myself separately. And then I just have to copy-paste it manually to persistentDataPath in iOS but I don't know how to do it. Anyone can help me?
Note : I don't wanna use any script/code to do it, just manually Copy-Paste it...\
thank you,

You need to set "Application Supports iTunes file sharing" key in the info plist of your app in Xcode.
...and then you can access persistentDataPath through iTunes.
(In the example screenshot below I copied midi.csv from my MacBook to excel in my iPad)

To make it more comfy add a PostProcessBuild-script like this one (gist).
It applies the setting after each build, so no manual steps.

Related

Open ipa within an ipa in iOS

As stated in my question above, is it possible to have an ipa file within another ipa? To further explain, here is my situation:
I have two apps and the first one calls the other through URL Scheme. I don't have problem with this. But what I need is to install only one ipa file instead of two. And the first thing that came into my mind is to put a .ipa file inside the other .ipa file. I really don't know if this is possible that's why I need your take on this. But if this is not possible, I hope someone can tell me what would be the best practice to doing this kind of thing.
I can make it as one application, but that would be my last solution.
There are no way to use another app in side app. but you can set a screen like.
You need to check with schema that application install in device or not. If not then user need to redirect to app store. User need to install and then while you go with same flow in app that open second app.
referance answer for check app install or not is following: Detecting programmatically whether an app is installed on iPhone

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 )

iOS app updating process

Apologies if this has been asked before but I couldn't find anything specific to my situation..
I've been tasked with creating a new version of an app already on the market place.
Unfortunately, the client only has access to the binary and not the source code as the previous development team didn't provide this information.
The client has been unable to get in touch with the previous development team so I can assume getting a hold of the original source code is off the table.
I was wondering, in a case like this, how does the iOS upgrade procedure work?
As an additional question, is it possible for the new app to access the data stored by the old app and if so, can anyone point me in the right direction on how to go about doing this please?
Thank you!
To make the update you must have the same bundleIdentifier as the current version. This will be displayed in iTunes Connect.
To get the stored data, you should use a tool called iFunBox.
Here's a little tutorial on how you can do it:
Steps for using iFunBox
Download the current version of the app
You should also use the apps functions, so the app saves the data you wish to extract.
Connect your iDevice to your Mac/PC
Download and install iFunBox (link here: http://www.i-funbox.com)
Launch the program and navigate to your device
Press "User Applications", then your application
Find the data the app stores
The NSUserDefaults plist-file is located in "Library" -> "Preferences" and is called com.yourCompany.appName.plist
A lot of apps also stores files in yourApp/Documents/
You can also explore the apps folder and look for the data you need. Hope this helps :)
If you have access to the iTunes Connect account, with which this app was published the problem is not too large: you can update app with any binary that have the same application id (bundle identifier) and larger version number.
You definitely can have access to the data of previous version - either it's stored in NSUserDefaults or app Documents folder etc., but you should have a clue of its format (e.g. keys of NSUserDefaults) - some reverse engineering of binaries can help.
You must know the bundleIdentifier and use the same otherwise the apps wont update.
The version number must also be higher than the current one
Also the data saved in the old app can be read but you need to know in which format it is.

Writing to a file in my iOS app

I have an app that downloads files that need to be edited and submitted back to the server through the app. These files could be anything, but are most likely to be .docs. I want to be able to open and edit these files in another app on the device, such as a .doc editor.
I've been able to get this functionality to work in similar Android and Chrome apps, but I'm very new to iOS so I'm not sure what my options are.
Is there a way to give permission for another app to edit a file that is in my app's sandbox? If not, is there a way to get the file back for submittal (like finding it through a file explorer launched through my app - similar to an 'Open..." file explorer dialog used in Windows/Mac OS/Chrome)? Am I going to have to create a way for the editor app to share the edited file back to my app?
Thanks in advance for your help!
To manage the file and the paths take a look at the documentation for NSFileManager:
https://developer.apple.com/LIBRARY/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
I usually write using NSFileHandle for reading and writing:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
Hope this helps.
iOS8 will provide methods to allow apps to co-operate with "extensions".
See "Creating Extensions for iOS and OS X, Part 1 & 2` in the WWDC14 videos.
Also see the Apple "App Extension Programming Guide".
I ended up sending the file to a 3rd party app for editing and then sending the file back from the 3rd app to my app.

iOS App's file associations ("open with..") / CFBundleDocumentTypes question

I have recently bought a perfect file manager app for my iPad. Everything in this app is great, besides that it cannot handle some specific file types.
So for example if I try to download the file in mobile safari and try to save it into the file manager (for further upload to dropbox, email and so on), I cannot do this because the app is not listed in the "open In" list.
The question is, how to associate this app with this specific file types? I've searched google and found out that app's file association information is stored in Info.plist file in the CFBundleDocumentTypes section.
So I just modified Info.plist but id didn't help. I also found the cracked version of this app and placed info.plist into the IPA file, reinstalled the app on the iPad and it also didn't help.
Any suggestions how to solve the problem?
You cannot just add the file types. The app also has to be coded to accept the request to open the file.
Try contacting the developer and ask for them to add this feature.
The problem is probably not the APP but a limitation on IOS: it is a random selection and only shows 10. I don't know if it randomly selects based on the ones you use most or what. You cannot change this other than to delete apps you don't use as often. But having said this, the app must also support the extension of the document you are trying to send: not just as a document it stores, but as a document it accepts as a transfer from another app. You can try to convert it first into a PDF and then open, if that's possible. Hope this helps.

Resources