基本上,我处境非常糟糕。我们的团队使用新功能成功开发和发布新版应用程序,用户可以购买(应用程序内购买)。 因此,我们已经使用iTunes测试用户测试了所有新功能,并且一切都运行良好,但是,当我们在appStore中看到发布版本与真正的iTunes用户时,存在一个巨大的问题。用户只需按下按钮即可购买应用程序内购买,在他输入其帐户密码并接受购买此新信息后。不幸的是,应用程序在此操作后每次都会崩溃。此后没有任何行动。
基本上,对于应用内购买,我使用MKStoreKit。 所以,我想提出以下行动的代码:
- (IBAction)buyNewRequest:(id)sender
{
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"uiAction"
action:@"Обработчик нажатия кнопки"
label:@"Кнопка - отправить запрос. Экран - запроса кредитной истории бки"
value:[NSNumber numberWithInt:100]] build]];
if ([self checkValidaionTextFields])
{
[DejalBezelActivityView activityViewForView:self.view withLabel:@"Подождите..."].showNetworkActivityIndicator = YES;
self.sendButton.enabled = NO;
[[MKStoreManager sharedManager] buyFeature:@"ru.financemart.nbki"
onComplete:^(NSString* purchasedFeature,
NSData* purchasedReceipt,
NSArray* availableDownloads)
{
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"uiAction"
action:@"Уведомление подтверждения покупки БКИ"
label:@"Уведомление - покупка бки. Экран - отправки запроса кредитной истории БКИ"
value:[NSNumber numberWithInt:100]] build]];
NSString *stringReceipt = [NSString stringWithFormat:@"%@", purchasedReceipt];
stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@" " withString:@""];
stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@"<" withString:@""];
stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@">" withString:@""];
NSString *base64Receipt = [self base64forData:purchasedReceipt];
NSString *hashDevelopKey = @"i5FnXIZ2aKjdn1Ru2VfLarbdCwbiJvfsnh9QTm9MB0I";
NSString *hashMD5 = @"";
hashMD5 = [hashMD5 stringByAppendingString:hashDevelopKey];
NSString *familyText = self.familyTextField.text;
NSString *nameText = self.nameTextField.text;
NSString *patronimicText = self.patronimicTextField.text;
NSString *passportID = self.passportID.text;
NSString *email = self.emailTextField.text;
NSString *dateOfBirth = dateOfBirthFormat;
NSString *passportDate = datePassportFormat;
NSString *regionForRequest = @"";
if ([[UnicomAPIConfigResponse lastResponse] cityByID:@(self.unicomProposalsModel.cityID).stringValue].ru_RU != nil) {
regionForRequest = [[UnicomAPIConfigResponse lastResponse] cityByID:@(self.unicomProposalsModel.cityID).stringValue].ru_RU;
}
hashMD5 = [hashMD5 stringByAppendingString:dateOfBirth];
hashMD5 = [hashMD5 stringByAppendingString:email];
hashMD5 = [hashMD5 stringByAppendingString:nameText];
hashMD5 = [hashMD5 stringByAppendingString:patronimicText];
hashMD5 = [hashMD5 stringByAppendingString:passportID];
hashMD5 = [hashMD5 stringByAppendingString:passportDate];
hashMD5 = [hashMD5 stringByAppendingString:base64Receipt];
hashMD5 = [hashMD5 stringByAppendingString:regionForRequest];
hashMD5 = [hashMD5 stringByAppendingString:familyText];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *stringToken = [[[[defaults valueForKey:@"deviceToken"] description]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]
stringByReplacingOccurrencesOfString:@" "
withString:@""];
hashMD5 = [hashMD5 stringByAppendingString:stringToken];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd.MM.yyyy"];
NSString *stringFromDate = [formatter stringFromDate:[NSDate date]];
hashMD5 = [hashMD5 stringByAppendingString:stringFromDate];
[DejalBezelActivityView activityViewForView:self.view withLabel:@"Отправляем..."].showNetworkActivityIndicator = YES;
[self.unicomService postNBKIRequestWithName:nameText WithFamily:familyText andPatronimic:patronimicText andDOB:dateOfBirth andPassport:passportID andPassportDate:passportDate andPartnerName:@"1" andEmail:email andToken:stringToken andReceipt:base64Receipt andHashKey:[self md5:hashMD5] andRegion:regionForRequest success:^(UnicomAPIRequestsNBKIResponse *response)
{
self.sendButton.enabled = YES;
} error:^(NSError *error) {
self.sendButton.enabled = YES;
[self performSelector:@selector(showError) withObject:nil afterDelay:2.0];
}]->addObserver( ^( TLSignal<NSDictionary *> *sender, NSDictionary *response )
{
[self performSelector:@selector(showSuccessPostRequest) withObject:nil afterDelay:0.0];
userModel = [CreditUserModel tlSharedInstance];
NSDictionary *dicta = [userModel.serverResponse valueForKey:@"result"];
NSString *dictb = [dicta valueForKey:@"id"];
NSMutableDictionary *paramNBKI = [[NSMutableDictionary alloc] init];
[paramNBKI setObject:dictb forKey:@"requestID"];
[paramNBKI setObject:self.familyTextField.text forKey:@"familyName"];
[paramNBKI setObject:self.nameTextField.text forKey:@"name"];
[paramNBKI setObject:self.patronimicTextField.text forKey:@"patronimic"];
[paramNBKI setObject:passportID forKey:@"passportID"];
[paramNBKI setObject:dateOfBirth forKey:@"dateOfBirth"];
[paramNBKI setObject:passportDate forKey:@"passportDate"];
[paramNBKI setObject:base64Receipt forKey:@"baseReceipt"];
[paramNBKI setObject:[self convertDate:[NSDate date]] forKey:@"requestDate"];
NSUserDefaults *defaults= [NSUserDefaults standardUserDefaults];
if([[[defaults dictionaryRepresentation] allKeys] containsObject:@"nbkiHistory"])
{
NSMutableArray *nbkiHistory = [[NSMutableArray alloc] init];
nbkiHistory = [NSMutableArray arrayWithArray:[defaults valueForKey:@"nbkiHistory"]];
[nbkiHistory addObject:paramNBKI];
[defaults setObject:nbkiHistory forKey:@"nbkiHistory"];
NSLog(@"mykey found");
} else {
NSMutableArray *nbkiHistory = [[NSMutableArray alloc] init];
[nbkiHistory addObject:paramNBKI];
[defaults setObject:nbkiHistory forKey:@"nbkiHistory"];
}
self.sendButton.enabled = YES;
} );
}
onCancelled:^
{
self.sendButton.enabled = YES;
[DejalBezelActivityView removeViewAnimated:YES];
}];
}
}
因此,在用户接受应用内购买后,您可以看到我们服务器的POST请求([self.unicomService postNBKIRequestWithName :),但我们的服务器数据库日志中没有请求,因此应用程序在此代码之前崩溃。但是,没有代码字符串可以崩溃。