Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 3, 2012, 11:41 PM   #1
xArtx
macrumors 6502a
 
Join Date: Mar 2012
Writing files to Documents Dir

Hi Guys,
I've been using a Windows program like iPhone Browser to copy files over
to an application's documents directory, but it occurs to me that you can't
access application folders if the device is not jailbroken.

Is the standard way to copy files over just once for an initial setup
if the files are not already present to copy them from the main bundle to the
Documents directory at run time?
Cheers, Art.
xArtx is offline   0 Reply With Quote
Old Nov 4, 2012, 10:09 AM   #2
truehybridx
macrumors member
 
Join Date: Dec 2010
i believe in 5.x you could using iExplorer without a jailbreak, but in 6.x they locked that out from USB too...

They want you to use iTunes if the app supports it im afraid
truehybridx is offline   0 Reply With Quote
Old Nov 5, 2012, 01:55 AM   #3
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
I have used iExplorer too for this.

But like you said you yourself is checking on startup if a specific file is there, if not, then copy it over Also be careful of WHERE you put it if it's an app going on the appstore, you have to make sure it's not backed up to iCloud for no reason (if you put it in the DOcuments folder, it automatically goes there & will get your app rejected).

Greetings, noxx
__________________

iPad Mini, iPad 4, iPad 2, iPhone 3G,4,5, iMac 24", Mac Mini Last gen, Macbook Pro Retina with Dell U2711
jnoxx is offline   0 Reply With Quote
Old Nov 10, 2012, 12:38 AM   #4
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
Quote:
Originally Posted by jnoxx View Post
I have used iExplorer too for this.

But like you said you yourself is checking on startup if a specific file is there, if not, then copy it over Also be careful of WHERE you put it if it's an app going on the appstore, you have to make sure it's not backed up to iCloud for no reason (if you put it in the DOcuments folder, it automatically goes there & will get your app rejected).

Greetings, noxx
Thanks

Is there somewhere you can store and retrieve stuff that is accessible with
a PC, but without iTunes?

I was using an iPad program to sort a daily list of stock to replenish according to the locations the stock is kept.
Moving the files has now become difficult.

Or, is is possible to have one of the email file downloaders put the source
file somewhere accessible by my program and have it emailed back?
I have an app called quick Office that can mail attachments, but I think I'd need a jailbroken iPad to use ifile to get the file into Quick Office's documents directory so it could be sent.

Basically, any way of getting a small text file in and back out of an iPad would be nice.
Any ideas?
xArtx is offline   0 Reply With Quote
Old Nov 10, 2012, 02:43 AM   #5
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
I've implemented the sample that sends email with attachment from within the app,
so that part is sorted.

Now it's just a matter of getting the source file into it.
xArtx is offline   0 Reply With Quote
Old Nov 11, 2012, 04:25 AM   #6
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
I have no idea what you're trying to achieve You have multiple apps wanting to work together with sending files & then via mail or via pc?
I don't understand 100%, so I can 't answer your question easily
__________________

iPad Mini, iPad 4, iPad 2, iPhone 3G,4,5, iMac 24", Mac Mini Last gen, Macbook Pro Retina with Dell U2711
jnoxx is offline   0 Reply With Quote
Old Nov 11, 2012, 10:33 AM   #7
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
Quote:
Originally Posted by jnoxx View Post
I have no idea what you're trying to achieve You have multiple apps wanting to work together with sending files & then via mail or via pc?
I don't understand 100%, so I can 't answer your question easily
For starters I registered as a developer to program personally.
I have little interest in the app store (so no rules apply to what I do in the app),
but Apple makes no provision for personal programming.

The particular app receives a file from a work computer (formally via iexplorer straight into the app's documents directory).
The file from the work computer is a list of stock records arranged in order of a field that is useless to me.
The app sorts the file records in order of stock location making it much quicker to retrieve with a forklift, and then that file used to be copied back out of the ipad (again with iexplorer). I copy the file back to the computer to print it in the newly sorted order. This gives me more time to smoke & muck around at work.

That all went to hell when my jailbroken iPad clapped out, and I had to update to 6.0.1 not jailbroken.

So I have Apple's email sample implemented to send the file back out of the iPad,
but currently the only way I have to get it into the iPad in the first place is
to compile it with the app's main bundle which required my computer at home.

Basically, I'm looking for the easiest beginner way to get a file into the app's documents directory.
Cheers
xArtx is offline   0 Reply With Quote
Old Nov 11, 2012, 11:39 AM   #8
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
The easiest way is with iTunes file sharing. Apple's sample code DocInteraction shows how to do this.

You could also email it to yourself. On the device you could then use OpenIn from mail and have the file copied into your app's sandbox.

You can put the file onto a web server and then simply download it into your app from the web server. You can do this with web sharing from a Mac. There's something similar on Windows.

You could also build a web service that runs on your desktop computer and serves the file. Probably not easy.

Embedded web server in the app allows you to upload a file into the app. There are a number of open-source simple web servers that you can embed in an iOS app.

There are many apps that implement these features and if you get your document onto the device then you can use Open In, UIDocumentInteractionController to transfer the file to your app.

iTunes file sharing or email are the simplest of these options.
PhoneyDeveloper is offline   0 Reply With Quote
Old Nov 16, 2012, 03:54 AM   #9
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
That's comprehensive, and I feel I should reply, but haven't given it time
to make progress. I have populated the email attachment to send out.

With regard to the file being delivered to the device, I'll have to forget about
iTunes being installed on the work computers.
They can send emails though, and Openin sounds like the way to go to receive the file.

Is there a well known tutorial other then this:http://www.raywenderlich.com/1980/ho...n-your-ios-app

I haven't followed it yet, but when it comes to it, I'd rather know now if
there is any more "generally accepted" example.
Thanks, Art.
xArtx is offline   0 Reply With Quote
Old Nov 16, 2012, 08:31 AM   #10
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Dunno about other tutorials. Apple's DocInteraction sample code is an example I use a lot.
PhoneyDeveloper is offline   0 Reply With Quote
Old Nov 20, 2012, 07:56 PM   #11
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
Docinteration appears to be just for iTunes file sharing.

Didn't see a sample for the open in feature,
and couldn't even figure out how to edit my plist.info file
with the keys in the tutorial.

I set up a paste box, so I can just cut & paste for now since
the report is a plain text file, it works.
I can email myself the file and open it with QuickOffice,
and then copy the text and paste it into my app.

Obviously no good if the source file wasn't text, but ok for now.
xArtx is offline   0 Reply With Quote
Old Nov 20, 2012, 09:01 PM   #12
troop231
macrumors 601
 
troop231's Avatar
 
Join Date: Jan 2010
Quote:
Originally Posted by xArtx View Post
Docinteration appears to be just for iTunes file sharing.

Didn't see a sample for the open in feature,
and couldn't even figure out how to edit my plist.info file
with the keys in the tutorial.

I set up a paste box, so I can just cut & paste for now since
the report is a plain text file, it works.
I can email myself the file and open it with QuickOffice,
and then copy the text and paste it into my app.

Obviously no good if the source file wasn't text, but ok for now.
Are you trying to export a comma seperated .txt file or something similar? I may be able to help you with this, as I have written a way to export something similar using the built in iOS email composer.
troop231 is offline   0 Reply With Quote
Old Nov 21, 2012, 12:23 PM   #13
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Dicinteraction has four files built in and you can add more. If you choose the jpeg file, for instance, then tap near the top of the screen you can Open In any other app that registers that it can accept jpeg files. It uses UIDocumentInteractionController for this. If your app registers for a file this sample app will send it to your app.
PhoneyDeveloper is offline   0 Reply With Quote
Old Nov 22, 2012, 11:15 PM   #14
xArtx
Thread Starter
macrumors 6502a
 
Join Date: Mar 2012
Quote:
Originally Posted by PhoneyDeveloper View Post
Dicinteraction has four files built in and you can add more. If you choose the jpeg file, for instance, then tap near the top of the screen you can Open In any other app that registers that it can accept jpeg files. It uses UIDocumentInteractionController for this. If your app registers for a file this sample app will send it to your app.
Oh man, I should be embarrassed about feeling proud for auto pasting
the clipboard right where I want it at application launch.
I paste straight to a text view, and read from there to a c char array,
then hide the iOS text view.
Very clean don't you think? but yes, the open in functionality would make
the current setup look silly

@ troop231,
I have taken care of creating and sending the csv file already.
Had to learn how to number the pages in the footer, and show
the title row for every printed page in MS Excell.
xArtx is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mavericks SMB share doesn't show more than 99 files in a dir on Windows Dymium OS X Mavericks (10.9) 0 Nov 22, 2013 06:34 PM
writing midi files Chirone iPhone/iPad Programming 0 Jun 5, 2013 07:51 PM
How To Drag Files From iTunes To Documents ??? musicmad2000 MacBook 2 May 23, 2013 06:57 AM
files, documents and entourage id have all disappeared from desktop and documents fol jane5ok Mac OS X 10.7 Lion 3 Oct 9, 2012 08:07 AM
Missing Files in Documents Stack b-rad g Mac OS X 10.7 Lion 2 Jul 2, 2012 03:00 PM

Forum Jump

All times are GMT -5. The time now is 07:28 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC