Reputation: 21
This in the function which i am implementing
-(NSString *)DeleteFolder:(NSInteger)FolderId;
In my implementation, I am creating string using FolderId
NSString *dbScript = [NSString stringWithFormat:@"Delete from Folders Where FolderId = %d",FolderId];
but I am not getting FolderId , instead of folder ID i am getting a very long integer value. Might be pointer reference.
Please tell me how to get folder id. Am I doing any thing wrong?
Upvotes: 2
Views: 4003
Reputation: 15035
Try like this:-
NSInteger a=20;
NSLog(@"yourInteger=%ld",(long)a);
Upvotes: 3
Reputation:
NSInteger
is not a portable type in the sense that you can never know if it's defined to int
, long
, long long
or something else. So, the %d
conversion specifier, which is exclusively for int
, is not suited for printing an NSInteger
. More precisely, its usage will result in undefined behavior. You will need to do an explicit typecast:
NSLog(@"Folder ID: %lld", (long long)FolderID);
(I used long long
because that's the longest possible standard integer type.)
Upvotes: 4