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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:11:39+00:00 2026-06-08T12:11:39+00:00

I was having an issue with my UPDATE statement as I was telling here:

  • 0

I was having an issue with my UPDATE statement as I was telling here: Update issue with sqliteManager

I found out that initWithFormat WORKS

NSString *sqlStr = [[NSString alloc] initWithFormat:@"UPDATE User SET Name = :Name WHERE Id = :Id"];

BUT not stringWithFormat:

 NSString* sqlStr = [NSString stringWithFormat:@"UPDATE User SET Name = :Name WHERE Id = :Id"];

Why is this as such? I would like to understand the logic/reasoning behind..

  • 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-08T12:11:40+00:00Added an answer on June 8, 2026 at 12:11 pm

    I have just found something interesting from this thread: How to refresh TableView Cell data during an NSTimer loop

    This, I believe, is the reasoning behind..

    I quote what “petergb” said:

    [NSString stringWithFormat:…] returns an autoreleased object. Autoreleased objects get released after control returns from the program’s code to the apple-supplied run-loop code. They are more or less a convenience so we don’t have to release all the little objects that we use once or twice here and there. (For example, imagine how tedious it would be if you had to release every string you created with the @”” syntax…)

    We can tell stringWithFormat: returns an autoreleased object because, by convention, methods who’s names don’t start with alloc or copy always return auto-released objects. Methods like this are said to “vend” an object. We can use these objects in the immediate future, but we don’t “own” it (i.e. we can’t count on it being there after we return control to the system.) If we want to take ownership of a vended object, we have to call [object retain] on it, and then it will be there until we explicitly call [object release] or [object autorelease], and if we don’t call release or autorelease on it before we lose our reference to it by changing the variable to something else, we will leak it.

    Contrast with [[NSString alloc] initWithFormat:. This method “creates” an object. We own it. Again, it will be there until we explicitly call [object release].

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

Sidebar

Related Questions

I'm having a issue with capistrano in that when an update_code or symlink fails
Having an interesting issue with redirects. On my user update page (at /username/edit), users
Having issue with slider navigation. Works perfectly fine when there are no other unordered
I having issue that content assistant / intellisense is working in methods such as
I'm having an issue where I'm trying to update the background gradient of an
I'm having some issues using checkboxes in combination with an insert/update statement. As it
I'm having issue with Action Listener of a JTable that being updated according the
I'm having an issue with a binding that I'm trying to implement. It will
I am having an issue handling HTTP URL Connections that do not return data.
Hi I have got some code that is reported as having the NP_GUARANTEED_DEREF issue

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.