gpt4 book ai didi

iOS Urban Airship 进度和 HUD

转载 作者:行者123 更新时间:2023-11-28 23:07:33 25 4
gpt4 key购买 nike

我真的被困在这个问题上了。我们有一个 IAP,其中 ListView 是我们自己的,我们直接指向 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]: unrecognized selector sent to instance 0x3e2c10 2012-01-30 12:23:18.840 isengua-en[12730:3827] * Terminating 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:]: unrecognized selector sent to instance 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 exception

最佳答案

您的刷新进度方法采用一个参数( float ),因此您的选择器末尾应该有一个冒号:

在 objective-c 中,这:

@selector(refreshProgress:)

与此不同:

@selector(refreshProgress)

它们是不同的方法名。

关于iOS Urban Airship 进度和 HUD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9063956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com