Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:56:00+00:00 2026-06-09T05:56:00+00:00

my first music downloading app get rejected due to some issues in data storage

  • 0

my first music downloading app get rejected due to some issues in data storage guidelines. i tried to save my mp3 file in NSDocumentDirectory. i need to resubmit my app by adding flag “Do not backup”.

here is my code,

  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);



  NSString *documentsDirectoryPath = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Music.mp3"];
  [receivedData writeToFile:documentsDirectoryPath atomically:YES];
  [self addSkipBackupAttributeToItemAtURL:downloadURL];



 - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL1
      {
          if (&NSURLIsExcludedFromBackupKey == nil) { // iOS <= 5.0.1
          const char* filePath = [[URL1 path] fileSystemRepresentation];

          const char* attrName = "com.apple.MobileBackup";
          u_int8_t attrValue = 1;

          int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
          return result == 0;
     } 
          else { // iOS >= 5.1
                    NSError *error = nil;
                   [URL1 setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];

                    return error == nil;
                     NSLog(@"success");
              }
      }

will this code work fine for my 5.1 version? bit confused

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:56:01+00:00Added an answer on June 9, 2026 at 5:56 am

    refer a following code.

    How do I prevent files from being backed up to iCloud and iTunes?

    iOS 5.1 and later

    - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
    {
        assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
    
        NSError *error = nil;
        BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                                      forKey: NSURLIsExcludedFromBackupKey error: &error];
        if(!success){
            NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
        }
        return success;
    }
    

    in iOS 5.0.1

    #import <sys/xattr.h>
    - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
    {
        assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
    
        const char* filePath = [[URL path] fileSystemRepresentation];
    
        const char* attrName = "com.apple.MobileBackup";
        u_int8_t attrValue = 1;
    
        int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
        return result == 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

long time reader, first time asker... I am making a music app which uses
My idea: syncing music without wifi or bluetooth. First I get the the files
first take a look on this picture from localScope app : i have 2
first of all some details: I configured security as below in web.xml view plaincopy
First, some context: I'm a Python developer who has written a medium-sized application using
The music app on the iPad has quite a lot of interesting custom UI
I am creating an Android application which will have some embedded music inside of
I have an android app that has mutliple activities The first main activity starts
I'm working on a music player, which receives a playlist with remote mp3 files
I released my first Android app two weeks ago (an MMO called Agent Syndicate)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.