Plies Neyo
Plies Neyo

Reputation: 247

iTunes file sharing. But sharing over http? iOS

I have a file which I want to file share. 'hello.mp3' At the moment the code enables file sharing if the file is in the app. I was hoping I would be able to do it over http. So file sharing with the link instead of the sound being in the app. I want to do this because it will save memory for the user.

Here is the current code. The code allows file sharing if the file is in the app. I want it so the user will 'download' the sound from a http server such as http://test.com/hello.mp3

Thanks

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSArray *names = [NSArray arrayWithObjects: @"hello.mp3", 
                                                @"hi.mp3", nil];
    for (NSString *fileName in names)
    {
        NSFileManager *fileManager = [NSFileManager defaultManager];
        NSError *error;
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:fileName];

        if (![fileManager fileExistsAtPath:documentDBFolderPath])
        {
            NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName];
            [fileManager copyItemAtPath:resourceDBFolderPath toPath:documentDBFolderPath error:&error];
        }
    }
}

Upvotes: 0

Views: 312

Answers (2)

Chad Adams
Chad Adams

Reputation: 1329

Correct, you can "stream" content over HTTP, but if your using HTTP AND saving to the "Documents" directory to hold content you risk rejection by the app store.

If you need a workaround maybe use the "tmp" directory and save a file off a file there. The complaint Apple has is mainly using phone data more than should be in a 3rd party application.

Upvotes: 0

TheTwoNotes
TheTwoNotes

Reputation: 463

I may be wrong, but that may not be allowed. In the guidelines:

2.7 Apps that download code in any way or form will be rejected.

While an audio file may not be "code", if it is used within the app, perhaps as a language translation item, etc...I would think it would be rejected...just my 2 cents worth though.

Upvotes: 1

Related Questions