大佬教程收集整理的这篇文章主要介绍了ios – 使用iPhone检测频率值,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
ViewController.h
#import <UIKit/UIKit.h> @class RIOInterface; @interface ViewController : UIViewController { BOOL isListening; float currentFrequency; RIOInterface *rioRef; // HERE I'M GETTING ISSUE } - (IBAction)startListenWatermark:(UIButton *)sender; @property(nonatomic,assign) RIOInterface *rioRef; @property(nonatomic,assign) float currentFrequency; @property(assign) BOOL isListening; #pragma mark Listener Controls - (void)startListener; - (void)stopListener; - (void)frequencyChangedWithValue:(float)newFrequency; @end
ViewController.m
@synthesize isListening; @synthesize rioRef; @synthesize currentFrequency; - (IBAction)startListenWatermark:(UIButton *)sender { if (isListening) { [self stopListener]; } else { [self startListener]; } isListening = !isListening; } - (void)startListener { [rioRef startListening:self]; } - (void)stopListener { [rioRef stopListening]; } - (void)frequencyChangedWithValue:(float)newFrequency { NSLog(@"FREQUENCY: %f",newFrequency); }
在代码中你可以看到我的问题在哪里,Xcode说:带有assign属性的现有实例变量’rioRef’必须是__unsafe_unretained.如果我删除了给出这个错误的行,那么app就不会调用方法[rioRef startListening:self];和[rioRef stopListening];.
在文件RIOInterface.mm中,我在第97行收到另一个错误,Xcode建议我更改它:
RIOInterface* THIS = (RIOInterface *)inRefCon; --> RIOInterface* THIS = (RIOInterface *)CFBridgingRelease(inRefCon);
callbackStruct.inputProcRefCon = self;
它告诉我这个:从不兼容的类型’RIOInterface * const__strong’分配’void’,所以我查看了网络,我找到了这个解决方案:
callbackStruct.inputProcRefCon = (__bridge void*)self;
我不确定这样做是否正确,我希望你能帮助我解决这个问题,谢谢你的建议.
以上是大佬教程为你收集整理的ios – 使用iPhone检测频率值全部内容,希望文章能够帮你解决ios – 使用iPhone检测频率值所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。