Questions tagged [writetofile]

for questions concerning the writeToFile method, part of the NSData class in OS X and iOS

This tag should be used for questions that relate to the use of one or more of the various writeToFile methods, which are provided by the NSData class in both the Mac OS X and iOS APIs.

The Apple developer documentation for the NSData class is available online here.

351 questions
4
votes
3 answers

Android 6 - Writing to external storage fails ON FIRST RUN ONLY

I know a question almost like this was asked several times but that problem is different. I need to write data to the external storage. I know I need to ask for permissions at runtime on Android 6. All this works fine so far. Just one thing is…
Tobias Reich
  • 4,414
  • 2
  • 42
  • 77
4
votes
2 answers

How to Write data to file in angularJS

I have a variable with huge data some thing like this. $scope.employees = [ {"firstName":"John", "lastName":"Doe", "city": "Bangalore","State":karnataka,}, {"firstName":"Anna", "lastName":"Smith", "city":…
Amrut
  • 387
  • 1
  • 5
  • 5
4
votes
2 answers

Alternative/faster method to slow StreamWriter to print strings to a file in C#

Some help from experts. I'm trying to use the function below to print strings to a file. When I use Console.Write() or Console.WriteLine() the output file grows up 3MB or 4MB per seconds, but when I try to use StreamWriter or File.AppendAllText the…
Sarmeu
  • 85
  • 2
  • 9
4
votes
1 answer

Deleting file from device after using [NSData writeToFile:]

In my code I'm doing: [anNsDataObject writeToFile:@"thefile" atomically:YES]; How can I delete this file from my device?
Jacksonkr
  • 29,242
  • 36
  • 164
  • 265
3
votes
2 answers

What is the correct way to import & save Photos from iPhone Album?

I am Importing Photos from the iPhone Album to the documents folder of my application. This is my code. for (int j=0; j<[assetArray count]; j++) { ALAsset *assest = [assetArray objectAtIndex:j]; CGImageRef imageRef =…
Aravindhan
  • 15,380
  • 10
  • 51
  • 71
3
votes
3 answers

can't save plist. path is not writable

I'm saving a lot of informations in a plist. This one is by standart in my mainBundle. this is my method to load the path and the data from the plist. if the file in the "application support" folder doesn't exist, i'm copying it from the mainBundle…
Adrian
  • 516
  • 4
  • 20
3
votes
0 answers

AttributeError: 'Series' object has no attribute 'has_z'

I got the following GeoDataFrame taken from a CSV file and after some slincing and CRS and geometry asignment ctf_nom geometry id 0 Prunus mahaleb POINT (429125.795043319 4579664.7564311) …
Rodrigo Vargas
  • 251
  • 2
  • 12
3
votes
2 answers

Ruby File.open not creating file

I'm trying to create and write to a new file using @logFile = File.open("C:\Users\---\Desktop\mylog.log", "w+") And nothing happens. My program uses @logFile.write ("Hello") @logFile.flush And this line seems to be running ok (no crashes or…
Itzik984
  • 13,250
  • 24
  • 66
  • 100
3
votes
3 answers

Cyrillic symbols shown strangеly when writing to a file

I have a class that has a string field input which contains UTF-8 characters. My class also has a method toString. I want to save instances of the class to a file using the method toString. The problem is that strange symbols are being written in…
bob_saginowski
  • 1,369
  • 2
  • 17
  • 33
3
votes
1 answer

NSdata writeToURL not working

i'm trying to save a NsData file into a directory. that is the code of my method: - (void)cacheImage:(NSData *)imageData withTitle:(NSString *)title { NSURL *cacheURL = (NSURL *)[[self.fileMenager URLsForDirectory:NSCachesDirectory…
Max_Power89
  • 1,604
  • 1
  • 18
  • 36
3
votes
2 answers

Not able to write nsdata in a folder

Below is the Code: NSData * imageData = [NSData dataWithContentsOfURL:imageURL]; [imageData writeToFile:savedImagePath options:NSDataWritingAtomic error:&error]; if(error != nil) NSLog(@"write error…
Mohammed Ebrahim
  • 825
  • 1
  • 12
  • 22
2
votes
1 answer

Read/Write Byte array Android

Trying to write a byte[] to a file, which i think is working correctly String filename = "BF.dat"; public void WriteByteToFile(byte[] mybytes, String filename){ try { FileOutputStream FOS = openFileOutput(filename,…
Jake Graham Arnold
  • 1,331
  • 2
  • 18
  • 37
2
votes
2 answers

What is the path of photos album on iPhone device?

I was trying to save a PNG file to photos albums folder on the iPhone device with a .png extension so that the transparency remains.. My question is: What is the path of photos album UIImageWriteToSavedPhotosAlbum function is using? I am using data…
tiw
  • 431
  • 6
  • 19
2
votes
1 answer

UIImagePNGRepresentation writeToFile can errors be catched?

i render Thumbnails of newly recieved PDF Document to the Documents-Directory. I'm using the following code: CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("thedoc.pdf"), NULL, NULL); CGPDFDocumentRef bookPDF =…
MadMaxAPP
  • 909
  • 1
  • 11
  • 37
2
votes
1 answer

ObjC download file and save it to directory

Id like to "update" a local file from a server (save it to a directory). I tried EVERYTHING! NOTHING WORKS! That's my last attempt: NSURL *url = [NSURL URLWithString:@"http://www.doothie.com/QAFrameworks/QAUpdater.php"]; NSData *urlData =…
Smoothie
  • 261
  • 4
  • 11
1
2
3
23 24