我正在尝试检查服务器是在线还是离线:我遇到连接到它时有端口的问题
我的代码目前:
struct sockaddr_in address;
address.sin_len = sizeof(address);
address.sin_family = AF_INET;
address.sin_port = htons(25667);
address.sin_addr.s_addr = inet_addr("fr7.mooshroom.net");
Reachability *reachability = [Reachability reachabilityWithAddress:&address];
Run Code Online (Sandbox Code Playgroud)
请让我知道我做错了什么.请不要把我与其他问题联系起来,我已经搜索过了,没有人能找到我正在寻找的东西.
我有一个UISearchBar,每当我开始输入它时,我都会收到以下崩溃报告
[__NSCFDictionary rangeOfString:options:]: unrecognized selector sent to instance 0x6a9d210
2012-07-10 14:46:52.956 MinePedia[275:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary rangeOfString:options:]: unrecognized selector sent to instance 0x6a9d210'
* First throw call stack:
(0x11f9052 0x15d5d0a 0x11faced 0x115ff00 0x115fce2 0xaad2 0x4754b2 0x11faec9 0x242515 0x2e872f 0x2e7e1e 0x2f4ce9 0x30112a 0xbf3a39 0x11c4885 0x11c47a8 0xb381aa 0x40a88e7 0x34b3917 0x3877111 0x387a4e1 0x408385b 0x40862e3 0x4086440 0x408301d 0x3869df0 0x3869ee3 0x4087119 0x388284d 0x3882b32 0x3896e12 0x3dfc0f7 0x3895245 0x38941f2 0x38948fb 0x3dfbca4 0x38a964e 0x38970a0 0x3879a0a 0x34e4ad9 0x11fae72 0x40a35bc 0x350b7f9 0x350d87f 0x3dfe03 0x3a3792 …
我试图从plist中获取一个整数并使用它sin_port.但是sin_port需要一个unsigned short而不是int 我如何将其转换int为unsigned short int?
iphone ×3
objective-c ×3
int ×1
ping ×1
reachability ×1
search ×1
uisearchbar ×1
uitableview ×1
unsigned ×1