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 6698593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:35:46+00:00 2026-05-26T06:35:46+00:00

I’m new to iOS. My requirement is to collect several error strings from inside

  • 0

I’m new to iOS. My requirement is to collect several error strings from inside the app and periodically post them to my web service. Each error is a simple NSString ~100 characters long. I may accumulate upto 1000 error records between posts. The actual post will be done on a background thread, but the collection and persistence of the error logs will be done on the main thread. I’m trying to decide between one of the following methods for persistence:

1) Property list serialization (my log records would be NSArray of NSStrings)

2) NSUserDefaults (my NSArray would be the value object for some key in NSUserDefaults)

3) Core Data (But just one NSManagedObject for the log and only one property inside of it, the log message string)

Note that I say “logs” but I’m doing all the logging work manually. (Is there any other option?)

One important factor for me is to incrementally persist the log records on disk. In other words, if I have already persisted 500 log records, and 501st comes along, I do not want to re-persist 500+1 log records for efficiency reasons.
It appears that using option (1) and (2) I cannot incrementally persist stuff. I think I’ll have to rewrite the blob everytime. I’m still studying option (3).
Just thought of getting an expert opinion on this 🙂

  • 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-05-26T06:35:47+00:00Added an answer on May 26, 2026 at 6:35 am

    * Update *
    No need for Core Data or anything like that.

    Just create a text file in your Documents directory call log.txt (anything is fine really).
    When you are ready to persist your NSArray, use the following method:

    - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
    

    Whenever you are ready you can post the file, clear its contents, and you are ready for the next array.


    I would use Core Data just because it makes everything so easy.

    On the other hand, you don’t really have to use either of them. If I am reading your question correctly you are already persisting the logs in your log files.

    You can store a lastPost date in NSUserDefaults, find your log files that were created after the lastPost date, post the log files, update the lastPost date and be done.

    On an unrelated note, sending logs like that could violate app guidelines depending on what you are sending and how clear it is to the user.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.