iphone - 警告 : passing argument 1 of 'setOn:' makes integer from pointer without a cast

标签 iphone objective-c ios ipad ios4

我是 Objective C 的新手,所以如果这是一个愚蠢的问题,我深表歉意。我在以下代码中收到此错误。

我正在使用 recurringBool 作为全局变量

//Declared in the AppDelegate.h
extern BOOL *recurringBool;

//Defined in the AppDelegate.m
BOOL *recurringBool;

// In another class this method sets recurringBool
- (IBAction)MakeRecurring:(id)sender {
    UISwitch *Switch = (UISwitch *)sender;
    //this is where the 1st error is occurring. aNetS is a UISwitch
    recurringBool = Switch.on;
        **//warning: assignment makes pointer from integer without a cast**
}

//And in another method aNetS is set to recurringBool;
//this is where the second error is occurring. aNetS is a UISwitch
aNetS.on = recurringBool;
    //warning: passing argument 1 of 'setOn:' makes integer from pointer without a cast

我不确定为什么会收到这些错误,因为 recurringBool 不是整数。所以我必须假设我用错了。任何帮助将不胜感激。

最佳答案

从 BOOL 声明中删除 *。 BOOL 不是指针。

关于iphone - 警告 : passing argument 1 of 'setOn:' makes integer from pointer without a cast,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7066996/

相关文章:

objective-c - 使用自己用 objective-c 编写的应用程序打开文件

ios - 无法停止 NSTimer

javascript - iPhone : load local html in uiwebview via javascript

ios - 如何在 iOS 中将视频作为背景?

iphone - UIWebView Fontsize 和 UItextView Fontsize 之间的区别

ios - Xcode : UITableViewCell customization like Facebook

ios - 在 MongoDB Realm 同步中建模子集合

ios - 单例中的委托(delegate)模式不起作用

iphone - iOS TabBar 图标设计技巧和实现 : How To?

iphone - 当父 View 为 UIScrollView UNTIL I scoll 时不显示 UITextView 文本