Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Updated %d to %@ when formatting the bookmark ID #3

merged 3 commits into from

2 participants


I found that when using %d the wrong value was being output. I noted from documentation that on a 64-bit build the NSInteger would be 64 bits in size, whereas for a 32-bit build NSInteger is just 32 bits in size.

Using %@ to "print" the NSInteger seemed to work fine - it actually gave me a representation that matched the values on Can you try this out and see if it works for you?

I also fixed the calls to bookmark.hash as I suspect that should have been bookmark.hashString.




You are absolutely right about the .hashString. Thanks for fixing that.

Regarding the NSInteger issue: using %d is in fact not working if you compile for a 64bit environment. However, %@ is not the proper way to handle this issue. Apple recommends that you use %ld instead and cast the var to long. Example:

NSInteger i = 42;
NSString *string = [NSString stringWithFormat:@"%ld", (long)i];

Can you change that so that I can merge your pull request?


I'll have to do some more testing, because switching to %ld does not have any improvement for me.

As a bit of background, I'm pulling down the bookmarks and storing them in Core Data - the bookmark ID is being stored in an "Integer 64" attribute type. The format is only coming out badly when it's been through Core Data so it might be getting mangled slightly as I move it in and out.

I'll do some more on it this evening if that's okay.




I think part of the problem is on my end with putting the NSInteger into and out of a Core Data store. I've updated my commits as you suggested and I'll figure out my own problem at a later stage :-)




@matthiasplappert - is everything okay with the updated pull request

@matthiasplappert matthiasplappert merged commit b186902 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2011
  1. Updated %d to %@ when formatting the bookmark ID - using %d or %ld wa…

    Maurice Kelly authored
    …s resulting in erroneous values.
  2. Updated %d to %ld when formatting the bookmarkID as an NSInteger is 6…

    Maurice Kelly authored
    …4 bits on a 64-bit build.
Commits on Sep 8, 2011
  1. Updated version of JSONKit

    Maurice Kelly authored
This page is out of date. Refresh to see the latest.
4 InstapaperKit/IKBookmark.m
@@ -59,9 +59,9 @@ - (id)initWithBookmarkID:(NSInteger)bookmarkID
- (NSString *)description
- return [NSString stringWithFormat:@"<%@: %@ (%d), URL:(%@)>", NSStringFromClass([self class]),
+ return [NSString stringWithFormat:@"<%@: %@ (%ld), URL:(%@)>", NSStringFromClass([self class]),
- self.bookmarkID,
+ (long)self.bookmarkID,
6 InstapaperKit/IKEngine.m
@@ -151,9 +151,9 @@ - (NSString *)bookmarksInFolder:(IKFolder *)folder limit:(NSUInteger)limit exist
NSMutableString *have = [NSMutableString string];
if ([bookmarks count] > 0) {
for (IKBookmark *bookmark in bookmarks) {
- [have appendFormat:@"%d", bookmark.bookmarkID];
- if (bookmark.hash) {
- [have appendFormat:@":%@", bookmark.hash];
+ [have appendFormat:@"%ld", (long)bookmark.bookmarkID];
+ if (bookmark.hashString) {
+ [have appendFormat:@":%@", bookmark.hashString];
if (bookmark.progressDate && bookmark.progress != -1.0f) {
int timestamp = (int)[bookmark.progressDate timeIntervalSince1970];
2  InstapaperKit/Third Party/JSONKit
@@ -1 +1 @@
-Subproject commit 1b123b653b53c74948640fe05564db6feda98b62
+Subproject commit c2146ffeb10d92bfa1537d2033a3235825d1b261
Something went wrong with that request. Please try again.