Skip to content

Commit

Permalink
Fixed auto-filling of vendor ID (+ better error message if it fails)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Zorn committed Jun 21, 2012
1 parent 11cc282 commit 4cc218a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Classes/AccountsViewController+VendorID.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ - (void)findVendorIDsWithLogin:(NSDictionary *)loginInfo
[self dataFromSynchronousPostRequestWithURL:[NSURL URLWithString:@"https://reportingitc.apple.com/vendor_default.faces"] bodyDictionary:reportPostData response:NULL];

NSString *salesPage = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://reportingitc.apple.com/sales.faces"] usedEncoding:NULL error:NULL];

NSString *defaultVendorID = [salesPage stringByMatching:@">.*?\\s(8[0-9]{7})" capture:1];
NSString *defaultVendorID = [salesPage stringByMatching:@">.*?\\s?(8[0-9]{7})" capture:1];
if (!defaultVendorID) {
[self performSelectorOnMainThread:@selector(failedToLoadVendorIDs) withObject:nil waitUntilDone:YES];
} else {
Expand All @@ -127,7 +126,7 @@ - (void)finishedLoadingVendorID:(NSString *)vendorID

- (void)failedToLoadVendorIDs
{
[[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"The vendor ID could not be filled automatically. Please check your username and password or enter your vendor ID manually.", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil] autorelease] show];
[[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"The vendor ID could not be filled automatically. Please check your username and password or enter your vendor ID manually. You'll find it at the top of the Sales and Trends module on itunesconnect.apple.com.", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil] autorelease] show];
}

- (NSString *)stringFromSynchronousPostRequestWithURL:(NSURL *)URL bodyDictionary:(NSDictionary *)bodyDictionary
Expand Down

0 comments on commit 4cc218a

Please sign in to comment.