码迷,mamicode.com
首页 > 移动开发 > 详细

ios开发——错误总结篇&开发中常见错误和警告总结(七)

时间:2015-08-25 23:18:35      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

开发中常见错误和警告总结(七)

 

1:"No previous prototype for function" warning警告错误解决
 
CGPoint randomPoint()
{
    int half = 32;
    int freesize = 240 - 2 * half;
    return CGPointMake(random() % freesize + half, random() % freesize + half);
}

 

warning:No previous prototype for function "randomPoint"。如何取消这个警告错误呢?方法尝试了这两种都可以:

  • 1.方法上加修饰符static
  • 2.或者Project-Info -> TARGETS ->Build Settings -> LLVM GCC4.2 - Warnings组 -> Missing Function Prototypes   Yes->No
 

2:使用Reachability的问题) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;

 做ios网络开发的肯定会用到苹果的官方库Reachability。warning:

 1 + (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress; 

Declaration of ‘struct sockaddr_in‘ will not be visible outside of this function

解决办法很简单,Reachability.h中最前面添加头文件:#import <netinet/in.h> 

ios开发——错误总结篇&开发中常见错误和警告总结(七)

标签:

原文地址:http://www.cnblogs.com/iCocos/p/4758881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!