0

I'm creating an app with iCloud. But I have some problems.
It creates directory on iCloud using NSFileWrapper, then it creates NSData (text) file in NSFileWrapper directory.
I'm using this code to convert NSData to NSString:

text=[NSString stringWithUTF8String:[fileData bytes]];

And it works correctly only on the device, which creates this text file. On other devices file is loaded successfully, but when I try to convert or print it (or other call methods), result is **BAD_ACCESS** and object doesn't exist (retain count of file data is 2).

Any ideas?

cacau
  • 3,606
  • 3
  • 21
  • 42
Riddick
  • 375
  • 4
  • 14

1 Answers1

0

I think you should be converting it to a string like this:

NSString *string = [[NSString alloc] initWithData:[fileData bytes] encoding:NSUTF8Encoding];
Abizern
  • 146,289
  • 39
  • 203
  • 257
  • Yes. I try this way. But filedData was 0x0 0 link when this line executed. But fileData - 17 byte before this line. When I tried read convert copy or call some method for fileData my programm receive signal BAD_ACCESS. But on creator-device all works good. – Riddick Nov 19 '11 at 20:07