0

I try to write to the AppGroup shared container with the following Ojecttive-C code:

NSFileManager *fileManager = [NSFileManager defaultManager]; 
NSURL *path = [fileManager 
   containerURLForSecurityApplicationsGroupIdentifier:@"group.*myGroupIdentifier*"]; 
NSString *vtPath = [path.absoluteString stringByAppendingPathComponent:*fileName*]; 
[fileManager createFileAtPath:vtPath contents:nil attributes:nil]; 
NSFileHandle *vtData = [NSFileHandle fileHandleForWritingPath: vtPath];

At this point vtData is always nil, so I can't write there.

The Path with appended fileName looks like @"file:///Users/***/Library/Developer ... /data/Containers/Shared/AppGroup/ ... /Library/filename.dat"

I have not found a solution after searching for hours. What am I doing wrong?

thpitsch
  • 2,016
  • 2
  • 21
  • 27

1 Answers1

0

The problem was with the URL I got back: It startet with "file:///".

After converting to a path, it started with "file:/"

After removing the "file:" at the beginning it works now.

thpitsch
  • 2,016
  • 2
  • 21
  • 27