Giter VIP home page Giter VIP logo

Comments (3)

sunnyyoung avatar sunnyyoung commented on July 20, 2024

太少信息了,添加个All Exceptions断点看看

from applereserver.

ljysdfz avatar ljysdfz commented on July 20, 2024

I couldn't retrieve the whole of project since the GFW hinder me from reaching cocoapods.
So I'd got to do some own workarounds for orignal codes to get used to packets I had rounded up.
What's relieved is it worked out at last.
Here are some key codes:

-(void)loadStoreAndDevice {
self.deviceDictionary = [Device deviceDictionary];
NSString *url = @"https://reserve.cdn-apple.com/CN/zh_CN/reserve/iPhone/stores.json";
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:url] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Failed
if (error) {
return;
}
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
if (![result isKindOfClass:[NSDictionary class]]) {
return;
}
//Succeeded
dispatch_async(dispatch_get_main_queue(), ^{
self.storeArray = [Store objectArrayWithKeyValuesArray:result[@"stores"]];
[self.storeTableView reloadData];
});
}];
[task resume];
}

-(void)reloadAvailability {
NSString *url = [NSString stringWithFormat:@"https://reserve.cdn-apple.com/CN/zh_CN/reserve/iPhone/availability.json"];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:url] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Failed
if (error) {
return;
}
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
if (![result isKindOfClass:[NSDictionary class]]) {
return;
}
result = result[self.selectedStore.storeNumber];
NSMutableDictionary *mutableResult = result.mutableCopy;
[result enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull value, BOOL * _Nonnull stop) {
if (![value isKindOfClass:[NSString class]]) {
[mutableResult removeObjectForKey:key];
} else {
if (self.onlyAvailabilityButton.state) {
if ([value isEqualToString:@"NONE"]) {
[mutableResult removeObjectForKey:key];
}
}
}
}];
result = mutableResult.copy;
//Succeeded
dispatch_async(dispatch_get_main_queue(), ^{
self.availabilityDictionary = result;
[self.availabilityTableView reloadData];
});
}];
[task resume];
}

And the compressed project which I had removed sorts of heavy burden like YTKNetwork so as to complete the functionality of remote query without cocoapods:
AppleReserver-master.zip

In any case, thanks for you artwork.

from applereserver.

sunnyyoung avatar sunnyyoung commented on July 20, 2024

@ljysdfz 👍🏻 Well done!

from applereserver.

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.