私は本当にこれにこだわっています。リスト ビューが独自のものである IAP があり、購入のために UADetailView を直接ポイントします。このため、ダウンロードの進行状況をユーザーに知らせるプログレス バーがなく、ダウンロードのサイズが大きくなっています。MBProgressHud を使用できると思っていましたが、問題が発生しました。UA から HUD に進行状況を渡すことができないようです。シンプルなカウンターを使用してクロックを上げれば、HUD ですべて正常に動作します。彼ら自身のサンプルと同じくらい。
これが HUD コールです。
- (void)showWithLabelDeterminate {
HUD = [[MBProgressHUD alloc] initWithView:self.view.window];
[self.view.window addSubview:HUD];
// Set determinate mode
HUD.mode = MBProgressHUDModeDeterminate;
HUD.delegate =self;
HUD.labelText = NSLocalizedString(@"DownLoading","");
// myProgressTask uses the HUD instance to update progress
[HUD showWhileExecuting:@selector(refreshProgress) onTarget:self withObject:nil animated:YES];
}
そして私が使おうとしているリフレッシュ。
- (void)refreshProgress:(float)progress {
while (progress < 1.0f)
NSLog(@"++ progress for HUD: %f", progress);
HUD.progress = progress;
}
ただし、実行すると、このログでアプリがクラッシュします...
2012-01-30 12:23:18.838 isengua-en[12730:3827] -[UAProductDetailViewController refreshProgress]: 認識されないセレクターがインスタンス 0x3e2c10 に送信されました 2012-01-30 12:23:18.840 isengua-en[12730:3827] * 終了中app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UAProductDetailViewController refreshProgress]: unrecognized selector sent to instance 0x3e2c10' * First throw call stack: (0x30caa8bf 0x37e4f1e5 0x30cadacb 0x30cac945 0x30c07680 0x30c0922b 0xf4e59 0x37cbca91 0x37d505a1 0x36447c1d 0x36447ad8) terminate called throwing an exception[
同じ問題を抱えて解決した人はいますか?
変更を加えて更新...
- (void)showWithLabelDeterminate {
HUD = [[MBProgressHUD alloc] initWithView:self.view.window];
[self.view.window addSubview:HUD];
// Set determinate mode
HUD.mode = MBProgressHUDModeDeterminate;
HUD.delegate =self;
HUD.labelText = NSLocalizedString(@"DownLoading","");
// myProgressTask uses the HUD instance to update progress
[HUD showWhileExecuting:@selector(productsDownloadProgress:) onTarget:self withObject:nil animated:YES];
}
- (void)productsDownloadProgress:(float)progress count:(int)count {
HUD.progress = progress;
UALOG(@"[StoreFrontDelegate] productsDownloadProgress: %f count: %d", progress, count);
if (count == 0) {
NSLog(@"Downloads complete !");
}
}
そしてこれが購入ボタンに
- (void)purchase:(id)sender {
self.navigationItem.rightBarButtonItem.enabled = NO;
[UAStoreFront purchase:product.productIdentifier];
[self.navigationController popViewControllerAnimated:NO];
[[UAStoreFront shared] setDelegate:self];
[self showWithLabelDeterminate];
}
クラッシュログ:
2012-01-30 13:12:45.555 isengua-en[12886:6e27] -[UAProductDetailViewController productsDownloadProgress:]: インスタンス 0x3f7f70 に送信された認識されないセレクター 2012-01-30 13:12:45.557 isengua-en[12886:6e27] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UAProductDetailViewController productsDownloadProgress:]: unrecognized selector sent to instance 0x3f7f70' * First throw call stack: (0x30caa8bf 0x37e4f1e5 0x30cadacb 0x30cac945 0x30c07680 0x30c0922b 0xf5e21 0x37cbca91 0x37d505a1 0x36447c1d 0x36447ad8) terminate called throwing an例外