Giter Site home page Giter Site logo

Comments (8)

nicklockwood avatar nicklockwood commented on August 16, 2024

I see that you've closed the issue - did you figure out what the problem was?

from irate.

HHuckebein avatar HHuckebein commented on August 16, 2024

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.

nicklockwood avatar nicklockwood commented on August 16, 2024

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.

HHuckebein avatar HHuckebein commented on August 16, 2024

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.

HHuckebein avatar HHuckebein commented on August 16, 2024

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.

nicklockwood avatar nicklockwood commented on August 16, 2024

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.

HHuckebein avatar HHuckebein commented on August 16, 2024

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.

HHuckebein avatar HHuckebein commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.