我真的被困在這一個。 我們有一個IAP,其中列表視圖是我們自己的,我們直接指向UADetailView進行購買。因此,我們沒有一個進度條來告訴用戶下載是如何進行的,而且我們的下載量很大。 我以爲我可以使用MBProgressHud,但我遇到了一個問題。我似乎無法將UA的進展傳遞給HUD。如果我使用一個簡單的計數器記錄它,一切正常工作與HUD。很像他們自己的樣本。iOS城市飛艇進展和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恩[12730:3827 ] - [UAProductDetailViewController refreshProgress]:無法識別的選擇發送到實例0x3e2c10 2012-01-30 12:23:18.840 isengua烯[12730:3827] *終止應用程序由於未捕獲的異常 'NSInvalidArgumentException' 的,原因是:「 - [UAProductDetailViewContr奧勒 refreshProgress]:無法識別的選擇發送到實例0x3e2c10' *第一擲調用堆棧:(0x30caa8bf 0x37e4f1e5 0x30cadacb 0x30cac945 0x30c07680 0x30c0922b 0xf4e59 0x37cbca91 0x37d505a1 0x36447c1d 0x36447ad8)終止叫做拋出異常[
任何人在那裏,有同樣的問題並解決了它?
更新與chages ...
- (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烯[12886:6e27] - [UAProductDetailViewController productsDownloadProgress:]:無法識別的選擇發送到實例0x3f7f70 2012-01-30 13點十二分45秒。557 isengua恩[12886:6e27] *終止應用程序由於 未捕獲的異常 'NSInvalidArgumentException',原因是: ' - [UAProductDetailViewController productsDownloadProgress:]: 無法識別的選擇發送到實例0x3f7f70' *第一擲調用堆棧:( 0x30caa8bf 0x37e4f1e5 0x30cadacb 0x30cac945 0x30c07680 0x30c0922b 0xf5e21 0x37cbca91 0x37d505a1 0x36447c1d 0x36447ad8)終止叫做拋出異常
你能告訴我們一些細節:你的showWithLabelDeterminate和你的refreshProgress在哪裏。謝謝 – MartinMoizard 2012-01-30 12:41:47
@MartinMoizard我在UAProductDetailViewController.m中有 - - (void)購買激活它 – Jorgen 2012-01-30 12:44:58