iPad Swift Playgrounds shares blank .playgrounds file - ios

I have started a beginning Swift programming class, which is going well so far, but I do not have access to a Mac for Xcode. I do have Swift Playgrounds for iPad, which allows me to complete the assignments and test that they work, but when I try to share the .playground file, it exports a blank file. Is there a solution for this problem?
Failing that, is there a way to save a text file containing Swift code as a .playground file on a PC? Buying a Mac (even a used one) is not an option at the moment, and using the on-campus computer lab takes over 3 hours round trip, so even a very convoluted workaround would be preferable.

You can share the playground from the iOS app to Working Copy, an iOS Git client.
Save in Working Copy > Save as .playground dir
It's free to try and you can export the repository as a zip file. So you can save it to Dropbox, or e-mail it to yourself. If you get the paid version, or in-app purchase, you can push it up to Github, or Bitbucket, which would make it easier to share any changes back. Working Copy can be added to the list of locations you can import Playgrounds from so that would probably be a worthwhile investment.
The enterprise version is the same price as the in-app purchase on the free app and includes the features the in-app unlocks.
Working Copy - Powerful Git client by Anders Borum
https://appsto.re/gb/xONC1.i
Working Copy Enterprise by Anders Borum
https://appsto.re/gb/aEqH5.i
In testing the exporting of a zip file I found the Dropbox support a little glitchy. I had more luck doing 'Import to Evernote' which created a *-playground.zip in Evernote. I could then save that to Dropbox. I've not had a chance to confirm the e-mailed version but it looks okay.
Pushing the .playground up to Github works just fine.

Related

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 )

How to transfer a file created in an ios app to the mac

i'm starting the implementation of a feature for transfer some files (lets say csv files) created in an ios app to the mac.
But i've made some reading about the subject without anything conclusive.
So, can anyone point me a direction to follow in order to achieve my goal ? I need, somehow to access the files created on my app throw the mac
ITunes file sharing.
iCloud.
Network transfer. (This third party library works with iOS and OSX)

Retrieve files from iOS app Documents folder via command line

For the project I work on, we have to set up performance metrics. The way we do it is that the simulator writes CSV files to a known location. We then retrieve theses files and make graphs out of it. Piece of cake.
We also have these tests running on the device. In that case, the files are created in the Documents directory.
While I can retrieve these files via the organizer, I'd be much more interested in automating that.
How can I retrieve files from an iPhone app via the command line rather than the organizer?
You can actually access the content of your app from your computer, using https://github.com/phonegap/ios-deploy (originally https://github.com/ghughes/fruitstrap) .
It's as simple as :
./ios-deploy --download=/Documents --bundle_id com.mycompany.myapp -2 dest_dir
You can do much more, like listing the content of the app, debug using lldb etc.
You can use iFuse, as part of libimobiledevice
You can not access the documents folder on your iOS device from your computer without itunes.
I run an webserver within my app so i can download the files via http. For zero configuration setup i use Apples Bonjour.
look here:
https://github.com/robbiehanson/CocoaHTTPServer
https://developer.apple.com/bonjour/

Where does iPad app store data?

I have an iPad app that downloads PDF and audio files. I though these might be in the .ipa file (I used this thread ipad - extract images from application?) but I didn't see anything there.
Is there some way to find where these might be stored on a Mac (after syncing)?
Normally in many apps the media files will be downloaded to documents directory of app, which is inside the sandbox for the app. Simply telling when you instal a app OS will create a sand box, and all the data will be inside this sand box and only that particular app will have access to this data. So you will not be able to copy data.
Hope this answers your question.
The IPA is an application only. Once it is installed on your iPad, it becomes a "package". It does contain the data within that package with some apps that store locally. There is no Apple supported way to get to this data directly. Think of it like this. The IPA is kind of like a blueprint for a program. Like a blueprint for a shelf, I could build the shelf but the books wouldn't be stored in the blueprint. Only the shelf. When you install the app, the iPad builds your "shelf".

Modifying iOS IPA asset and resigning (preferably from Windows)

I'm working on an iOS game. I have access to mac, xcode, etc. The issue is that my artists and designers do not. I would like to give them an ipa and have them able to unzip, modify assets, and then rebuild and test the ipa without have to use a mac or xcode. The ipa doesn't need to be installable on any iOS device other than their test device. Is this possible?
I read a little bit about codesign that comes with xcode, but that appears to only run on a mac - are there alternatives? It looks like Marmalade (and maybe UDK) provides this functionality (resigning on a pc) to their users, but I don't want to use those engines.
Ultimately I am simply looking for a way for an artist or designer to test out their changes without requiring them to rebuild the ipa from xcode or a mac - any ideas? Is there a system for allowing artists or designers to add files to an iDevice that an app can access to self patch it's assets?
The best solution I could come up with was to use Dropbox's iOS API as a patch interface to download files into the document folder. Then whenever I go to load a file from my installed folders, I first check to see if the new asset exists within the patch folder and if so I use that file instead. A fairly basic concept that appears to be working surprisingly well for iOS devices.

Resources