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

  • SEARCH
  • Home
  • 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 8033653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:45:50+00:00 2026-06-05T01:45:50+00:00

I have a zip file in NSMainBuddle (code.zip) inside code.zip two file names.txt,group.txt, now

  • 0

I have a zip file in NSMainBuddle (code.zip) inside code.zip two file names.txt,group.txt, now i want to add one more file to code.zip file, ie i am trying to add Demo.txt.

- (IBAction)CreatezipAction:(id)sender{
ZipFile *zipFile= [[ZipFile alloc]initWithFileName:[[NSBundle mainBundle] pathForResource:@"code" ofType:@"zip"] mode:ZipFileModeCreate];
 ZipWriteStream *stream= [zipFile writeFileInZipWithName:@"Demo.txt" compressionLevel:ZipCompressionLevelBest];   
    NSString* str= @"Sample String…………";
    NSData* data=[str dataUsingEncoding:NSUTF8StringEncoding]; 
    [stream writeData:data];
    [stream finishedWriting];
}

its successfully adding to NSMainBunble because if i click button corresponding to lisAllFileAction: its will show like this….

- (IBAction)lisAllFileAction:(id)sender {
    ZipFile *unzipFile= [[ZipFile alloc]initWithFileName:[[NSBundle mainBundle] pathForResource:@"code" ofType:@"zip"] mode:ZipFileModeUnzip];
    NSArray *infos= [unzipFile listFileInZipInfos];
    for (FileInZipInfo *info in infos) {
        NSLog(@"- %@ %@ %d (%d)", info.name, info.date, info.size, info.level);        
    }
}

output on simulator
2

012-06-04 11:55:42.143 zipDemo[1757:207] - code-Zip/names.txt 2012-5-30 17:19:00 +0000 983 (-1)
2012-06-04 11:55:42.143 zipDemo[1757:207] - code-Zip/names.txt 2012-06-01 20:07:50 +0000 2563 (-1)
2012-06-04 11:55:42.144 zipDemo[1757:207] - Demo.txt 2012-06-04 06:25:40 +0000 12 (9)
  1. Now i want to know can manually open this Demo.txt?
  2. what is the difference b/w code-Zip/names.txt 2012-06-01 20:07:50 and Demo.txt 2012-06-04 06:25:40 +0000 12 (9)?
  3. Can create file in in NSMainBundle like this, any problem for app?
  4. Actually where Demo.txt file created?
  • 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-05T01:45:53+00:00Added an answer on June 5, 2026 at 1:45 am

    The mainBundle is read-only. You can’t write nothing in the mainBundle, you can just load. You should create your files in the Documents or Caches directory. So, the first time the app starts, you can copy the zip file from the mainBundle to the Documents directory, and then use this instead the zip file in the mainBundle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a zip archive: my_zip.zip . Inside it is one txt file, the
I have zip file inside a Text file (file.txt inside a file.zip) and I
I have one zip file that i want unzip .the size of this file
I have a zip file which has one base folder inside it with other
I have zip file in ftp server,this zip file contain more then one xml
I have an existing ZIP file (with some files) where I want to add
In one of my git projects, I have a zip file which bundles a
I have inherited some code (from zip file) from a developer and git initialzed,
I want to pack the project into a zip-file and have the build date
I have a ZIP archive that's embedded inside a larger file. I know the

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.