gpt4 book ai didi

iphone - uint32_t 数组的 NSLog 内容

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:02:58 27 4
gpt4 key购买 nike

我正在与另一位程序员合作编写一些代码。他用 C 语言编写了一个解码算法,并为我提供了一个 Objective-c 类作为包装器,以避免我必须处理对他的代码的调用。

他的.h文件是这样的

#import <UIKit/UIKit.h>
#import "decode_audio_data.h"


@interface DecoderWrapper : UIViewController {
uint32_t numberOfDecodedData;
uint32_t decodedData[MAX_DECODED_DATA_SIZE];
}


- (void) feedData:(int16_t [])data;
- (uint32_t) numberOfDecodedData;
- (uint32_t *) decodedData;


@end

现在,我可以毫无问题地调用“feedData”和“numberOfDecodedData”函数,但我在调用“decodedData”时遇到了一些问题,它应该返回一个 uint32_t 数组。

我如何 NSLog 该数组的内容?我很困惑,因为我不懂 C,而且我对指针不是很有信心....

这是我打电话的地方:

[decoderWrapped feedData:debug];

if ([decoderWrapped numberOfDecodedData] > 0) {
for (in j=0; j<[decoderWrapped numberOfDecodedData]; j++) {
// how do I print out every position of [decoderWrapped decodedData] ??

}
}

感谢任何帮助!

最佳答案

尝试

NSLog(@"%u", [decoderWrapped decodedData][j]);

在你的循环中,你到目前为止。

关于iphone - uint32_t 数组的 NSLog 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19250637/

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