Comments (8)
I see that you've closed the issue - did you figure out what the problem was?
from irate.
Correct me if I am wrong but I guessed you can actually test "real" behavior only on an app which is already on the store
and that's why your data object(ZeroConfig) contained more information than my own
project?!
Am 28.08.2012 um 16:09 schrieb Nick Lockwood [email protected]:
I see that you've closed the issue - did you figure out what the problem was?
—
Reply to this email directly or view it on GitHub.
from irate.
Yes, that's correct. It will work once the app is live, but not prior to submission.
If you set [iRate sharedInstance].debug = YES; then you can test what the behaviour will be once live (remember to remove that again before you submit).
from irate.
Okay.
Thx for your quick reply.
Am 28.08.2012 um 18:14 schrieb Nick Lockwood [email protected]:
Yes, that's correct. It will work once the app is live, but not prior to submission.
If you set [iRate sharedInstance].debug = YES; then you can test what the behaviour will be once live (remember to remove that again before you submit).
—
Reply to this email directly or view it on GitHub.
from irate.
Me again,
I was thinking about (instead of your debug option) to introduce a simulation mode.
If in simulation mode read the data we need from a prepared dictionary (values could be set automatically, e.g. bundleId or user defined).
Continue with the data object as usual.
I actually did that (see code below) but your method valueForKey:inJSON: failed.
So I was thinking about get rid of the method in favor of
converting the json data coming from iTunes into a dictionary and working with that,
but wanted to know if there was a special reason for writing that valueForKey:inJSON?
Okay. To keep it simple (using NSJSONSerialization) would limit simulation mode for iOS version greater 5.
What do you thing about that?
Kind regards
Bernd Rabe
554 NSData *data = self.simulate ? [self jsonDataInSimulationMode] :[NSData dataWithContentsOfURL:[NSURL URLWithString:iTunesServiceURL] options:NSDataReadingUncached error:&error];
-
(NSData *)jsonDataInSimulationMode
{
NSDictionary *jsonDict = @{
@"resultCount" : @1,
@"results" :
@[ @{ @"bundleId" : @"com.charcoaldesign.rainbowblocks" },
@{ @"primaryGenreName" : @"Games" },
@{ @"trackId" : @355313284 },
@{ @"version" : @"1.8.5" }]
};NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:(id)jsonDict
options:0
error:&error];
NSAssert1(error == nil, @"Failed to create json data object", [error localizedDescription]);return jsonData;
}
Am 28.08.2012 um 19:07 schrieb Rabe Bernd [email protected]:
Okay.
Thx for your quick reply.
Am 28.08.2012 um 18:14 schrieb Nick Lockwood [email protected]:
Yes, that's correct. It will work once the app is live, but not prior to submission.
If you set [iRate sharedInstance].debug = YES; then you can test what the behaviour will be once live (remember to remove that again before you submit).
—
Reply to this email directly or view it on GitHub.
from irate.
It's an interesting idea, but the only purpose I can think of would be for me to test that the library works correctly (which I can do by running it using a live app ID, as I do in the example projects). I don't see that an end user would get much benefit from it versus the existing debug mode option.
The valueForKey:inJSON method is purely to support iOS 4. I will eventually replace it with NSJSONSerialisation when I drop support for iOS 4, but there's no reason to do that now. I'm aware that it's a horrible hack, but I don't want to force people to use an arbitrary JSON library, and supporting all known JSON libraries (like AFNetworking does) requires a lot more, much nastier code.
If you do want to add a simulation mode for some reason, why not just use sample JSON data for simulation instead of a dictionary? Seems like it would make life easier.
from irate.
Well, thats what I did actually and the only code I had to change was adding an iVar, add one method and replace on line of code.
If there wouldn't be the problem in this valueForKey:inJSON:
I'll try to figure out what happens.
Am 29.08.2012 um 09:59 schrieb Nick Lockwood [email protected]:
It's an interesting idea, but the only purpose I can think of would be for me to test that the library works correctly (which I can do by running it using a live app ID, as I do in the example projects). I don't see that an end user would get much benefit from it versus the existing debug mode option.
The valueForKey:inJSON method is purely to support iOS 4. I will eventually replace it with NSJSONSerialisation when I drop support for iOS 4, but there's no reason to do that now. I'm aware that it's a horrible hack, but I don't want to force people to use an arbitrary JSON library, and supporting all known JSON libraries (like AFNetworking does) requires a lot more, much nastier code.
If you do want to add a simulation mode for some reason, why not just use sample JSON data for simulation instead of a dictionary? Seems like it would make life easier.
—
Reply to this email directly or view it on GitHub.
from irate.
My fault.
here is the corrected code.
It would give users the chance to test the whole iRate logic also for apps which are not on the store.
I leave it to you how to continue. (Its still not working for iOS < 5.0)
Anyway. Thanks for this peace of code. Couldn't find any better solution.
#pragma mark - Simulate JSON Object
-
(NSData *)jsonDataInSimulationMode
{
NSDictionary *jsonDict = @{
@"resultCount" : @1,
@"results" :
@[ @{ @"bundleId" : self.applicationBundleID,
@"primaryGenreName" : @"Games",
@"trackId" : @355313284,
@"version" : @"1.8.5" }]
};NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:(id)jsonDict
options:0
error:&error];
NSAssert1(error == nil, @"Failed to create json data object", [error localizedDescription]);return jsonData;
}
Am 29.08.2012 um 09:59 schrieb Nick Lockwood [email protected]:
It's an interesting idea, but the only purpose I can think of would be for me to test that the library works correctly (which I can do by running it using a live app ID, as I do in the example projects). I don't see that an end user would get much benefit from it versus the existing debug mode option.
The valueForKey:inJSON method is purely to support iOS 4. I will eventually replace it with NSJSONSerialisation when I drop support for iOS 4, but there's no reason to do that now. I'm aware that it's a horrible hack, but I don't want to force people to use an arbitrary JSON library, and supporting all known JSON libraries (like AFNetworking does) requires a lot more, much nastier code.
If you do want to add a simulation mode for some reason, why not just use sample JSON data for simulation instead of a dictionary? Seems like it would make life easier.
—
Reply to this email directly or view it on GitHub.
from irate.
Related Issues (20)
- iRate will be allowed for iOS 11? HOT 2
- useSKStoreReviewControllerIfAvailable is ignored HOT 4
- Significant event issue? HOT 5
- SKStoreReviewController is not used in manual prompt request HOT 2
- Use `+initialize` instead `+load` to instantiate iRate singleton HOT 3
- Submit button disabled on SKStoreReviewController HOT 4
- Localizations bug with Chinese simplified and traditional
- iOS 11 problem with opening app page in the App Store HOT 20
- Can you add prompt to update on new version available HOT 2
- How should I reset iRate totally?
- iRate Not show HOT 1
- Show Review Alert only if user has not submitted any review?
- ratedThisVersion not set if using SKStoreReviewController? HOT 4
- iOS Swift : Message and Message Title are not working
- iRate Delegates are Not getting Called
- iOS 11 (GM) prompts at launch even though promptAtLaunch set to NO & Submit button fails HOT 8
- Crash when sending `window` message to `UIApplicationDelegate`
- 您好,为什么弃用不维护了啊? HOT 2
- iRate did not prompt for rating because the app was first used less than 10 days ago HOT 1
- SwiftPM Support / swift package init
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irate.