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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:18:58+00:00 2026-06-18T06:18:58+00:00

Possible Duplicate: Why is my string potentially unsecure in my iOS application? New compiler

  • 0

Possible Duplicate:
Why is my string potentially unsecure in my iOS application?

New compiler warning since upgrading XCode to 4.6:

Format string is not a string literal (potentially insecure)

Smallest example demonstrating the warning on both of the final lines:

  for (NSUInteger i = 0; i < 10; i++) {
    NSString *res = [testInstance generate:i];
    NSString *desc = [NSString stringWithFormat:@"TestData: %d", i];
    STAssertNotNil(res, desc);
    STAssertNotEquals(@"", res, desc);
  }

I looked at other questions which concern this warning but they stem from programmers unnecessarily using stringWithFormat: – here I want a dynamic assert description which changes per iteration but not per check.

I can pass the format string and data into the Asserts but then I have to maintain the descriptions independently.

How can I avoid this warning if I require the formatting of a description is prior to using it in a log message or assert call?

  • 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-18T06:19:00+00:00Added an answer on June 18, 2026 at 6:19 am

    The problem are the non-literal format strings in the assertions. Change them to:

    STAssertNotNil(res, @"%@", desc);
    STAssertNotEquals(@"", res, @"%@", desc);
    

    Format strings are a common security issue. When they are not visible to the compiler it cannot check them. In your case they’ve been hidden in desc.

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

Sidebar

Related Questions

Possible Duplicate: SnowLeopard Xcode warning: “format not a string literal and no format arguments”
Possible Duplicate: Calling NSLog from C++: “Format string is not a string literal (potentially
Possible Duplicate: String won't url encode in iOS I am using ASIHttpRequest to send
Possible Duplicate: Warning: format not a string literal and no format arguments I have
Possible Duplicate: Platform::String is kind of useless I'm new to Windows development and the
Possible Duplicate: String object creation using new and its comparison with intern method I
Possible Duplicate: String is not equal to string? I'm new to java and I
Possible Duplicate: String with array structure to Array I have an array as such
Possible Duplicate: String formatting options: pros and cons What's the difference between %.2f %
Possible Duplicate: String, StringBuffer, and StringBuilder We know that String are immutable where StringBuffer

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.