3

I want to share file between multiple applications in iOS environment.

I'm already using the UIDocumentInteractionController mechanism to achieve the purpose but I'm facing a problem because the hight volume of data to exchange between the application (around 2Go).

I'm using the ZipArchive library to gather all the shared files, but it does fail in some case to create the huge zip file. I've tried to send a directory instead of the file, but the content is not copied.

As I'm upgrading to iOS 7, I'm trying to make the new available containerURLForSecurityApplicationGroupIdentifier method in NSFileManager working. I've followed the few example, but they are for the MAC OS X.

Is it an apple mistake to have made this API available for iOS 7 too or which instruction are required to make it working.

Here is the application entitlements file content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.application-groups</key>
    <array>
        <string>$(TeamIdentifierPrefix)com.example.AppFileSharing</string>
    </array>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)com.example.AppFileSharing</string>
    </array>
</dict>
</plist>

Here is the sample code to access the container:

NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* containerURL = [fileManager 
containerURLForSecurityApplicationGroupIdentifier:@"com.example.AppFileSharing"];
NSLog(@"%@", containerURL);

When I'm running the app, the containerURL is null.

It would be really great to have this function working.

Regards,

DAB

dab
  • 31
  • 1
  • 3
  • hi you get solution for that? – Hitendra Mar 22 '14 at 07:25
  • 1
    I had little success on iPhone Simulator, but was not able to run it on real iPad. I was not able to make further tests since this post. What you need to notice is the Team information in General properties of your target. It means maybe this behavior is dedicated to enterprise program. – dab Mar 23 '14 at 08:14

2 Answers2

3

You probably have not enabled App Groups for your app. You will have to create a Identifier for your App Group in Member Center on the Apple developer site.

enter image description here

enter image description here

n6xej
  • 461
  • 5
  • 15
0

I just started working with this today to play with iOS 8 App Extensions. I got it to initially work (returning a real directory and not nil) by prepending my developer team ID to the identifier.

NSURL* containerURL = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"YOUR_TEAM_ID.com.example.AppFileSharing"];

LeffelMania
  • 12,765
  • 4
  • 32
  • 34
  • Hi LeffelMania,were you able to make a test on a real iPad? – dab Jul 04 '14 at 20:10
  • I haven't tested on any real devices yet, no. The features I'm trying to take advantage of are iOS 8 only, and I haven't installed the beta on any of my devices yet. – LeffelMania Jul 05 '14 at 20:38
  • Can I use same group name in different developer account to share files between different developers apps? – Sunil Targe Jul 18 '16 at 03:11