Amazon.com Widgets 15.3 Build Generated issues.
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 21, 2014, 08:05:48 AM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Program Examples
| | |-+ Chapter 15
| | | |-+ 15.3 Build Generated issues.
Pages: [1] Go Down
Print
Author Topic: 15.3 Build Generated issues. (Read 1189 times)
ScottS
Newbie
*
Posts: 5






on: May 17, 2011, 11:47:12 AM

I can't seem to be able to figure out what it is that's wrong.
The program builds and runs correctly, but X-Code says that build generates issues.

Line 23 (below) indicates 3 warnings as follows:

1- Unused Entity Issue
    Expression result unused

2- Format String Issue
    More '%' conversions than data arguments

3- Unused Entity Issue
    Expression result unused

Heres the code and output...
Code: (Objective-C)
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSString *str1 = @"This is string A";
    NSString *str2 = @"This is string B";
    NSString *res;
    NSComparisonResult compareResult;
   
   
    // Count the number of characters
    NSLog(@"Length od str1 %lu", [str1 length] );
   
    // Copy one strig to another
    res = [NSString stringWithString:str1];
    NSLog(@"copy: %@", res);
   
    // Copy one string to the end of another
    str2 = [str1 stringByAppendingString:str2];
    NSLog(@"Concatentation %@"), str2;
   
    // Test of two strings are equal
    if ([str1 isEqualToString:res] == YES) {
        NSLog(@"str1 == res");
    } else {
        NSLog(@"str1 != res");
    }
    // Test if one string is <, ==, or > to another
    compareResult = [str1 compare: str2];
    if (compareResult == NSOrderedAscending)
        NSLog(@"str1 < str2");
     else if (compareResult == NSOrderedSame)
           NSLog(@"str1 == str2");
     else
        NSLog(@"str1 > str2");
   
    // Convert string to uppercase
    res = [str1 uppercaseString];
    NSLog(@"Uppercase Conversion: %@", res);
   
    // Convert to lowercase
    NSLog(@"Lowercase Conversion: %@", [str1 lowercaseString]);
   
    NSLog(@"Original String: %@", str1);
    [pool drain];
    return 0;
}
Code: (Objective-C)
// Program Output

This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
sharedlibrary apply-load-rules all
[Switching to process 2148 thread 0x0]
2011-05-17 12:50:29.371 PiOC_15-3[2148:903] Length od str1 16
2011-05-17 12:50:29.373 PiOC_15-3[2148:903] copy: This is string A
2011-05-17 12:50:29.374 PiOC_15-3[2148:903] Concatentation This is string AThis is string B
2011-05-17 12:50:29.374 PiOC_15-3[2148:903] str1 == res
2011-05-17 12:50:29.374 PiOC_15-3[2148:903] str1 < str2
2011-05-17 12:50:29.375 PiOC_15-3[2148:903] Uppercase Conversion: THIS IS STRING A
2011-05-17 12:50:29.375 PiOC_15-3[2148:903] Lowercase Conversion: this is string a
2011-05-17 12:50:29.376 PiOC_15-3[2148:903] Original String: This is string A
Program ended with exit code: 0

Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #1 on: May 17, 2011, 01:56:10 PM

Line 23, the argument needs to be inside the parens:

Code: (Objective-C)
NSLog(@"Concatentation %@", str2);

Cheers,

Steve
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.