printdotio / printio-ios-sdk

SDK that enables the printing of any photo, from any source, onto any product!
Other
20 stars 11 forks source link

printIO getVersion returns nil #457

Closed arik-so closed 9 years ago

arik-so commented 9 years ago

When running the following with an instance of PrintIO:

[printIO getVersion:^(PIOVersion *version) {
}];

all the properties of PIOVersion are either 0 or empty strings.

perisicboro commented 9 years ago

@arik-so Because, for yours recipeId it is not set. For what do you use this?

arik-so commented 9 years ago

The recipe ID should definitely be set, because I set it in the previous call when I get the instance of PrintIO, which is printIO.

To answer your question, we were contemplating using it to keep track of which version of Print.IO are users are currently using, seeing how not every release of our own may include an update of the Print.IO SDK.

perisicboro commented 9 years ago

That method doesn't return current version of sdk. To get what you want, use this:

NSDictionary *infoDictionary = [[NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"PrintIOBundle" withExtension:@"bundle"]] infoDictionary];
NSString *version = [NSString stringWithFormat:@"%@(%i)", [infoDictionary valueForKey:@"CFBundleShortVersionString"], [[infoDictionary valueForKey:@"CFBundleVersion"]intValue]];
NSLog(@"version: %@", version);
arik-so commented 9 years ago

Indeed, works like a charm.