zoukankan      html  css  js  c++  java
  • ios 6.1中 Release问题

      程序中有如下代码:


     
    1. UIAlertView *alert = [[UIAlertView alloc]     
    2.                       initWithTitle:@"Something was done."     
    3.                       message:@"ok"     
    4.                       delegate:self     
    5.                       cancelButtonTitle:@"OK!"     
    6.                       otherButtonTitles:nil];    
    7. [alert show];    
    8. [alert release];   

    在xcode环境中 报告错误

     error: 'release' is unavailable: not available in automatic reference counting mode [3]


    解决办法:

    在xcode中选择 project navigator (最左边的视窗)->选中项目名称 ->在主窗口中显示的 project 和targets中选择 project面板->选择building settings-> 在Apple LLVM compiler 3.0 -language 中选择 Ojective-C Automatic Reference couting 选项,把yes 修改成no。

    也可以在建立项目的时候不要选择Using Automatic Reference counting 选项。

     

    ARC 是4.2新提供的选项

     

    相关文章可以查看 

    http://stackoverflow.com/questions/6914453/dealloc-method-gone-from-the-viewcontroller-implementation-file-template-in-xcod

     

    主要意思是 

     

    Most likely you have created a project that uses the new ARC (Automatic Reference Counting) and therefore do not need the dealloc method because calling retain or release is no longer allowed when compiling with this option.

    所以不需要去手工release了

  • 相关阅读:
    可配置智联爬虫
    python 交错列表合并
    猫途鹰简单爬虫正则巩固
    urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) 解决办法
    与MongoDB有关的面试题
    go tcp socket
    postgresql摘要
    go+postgresql服务器
    go map slice array channel 传参
    postgresql 数据库学习
  • 原文地址:https://www.cnblogs.com/newsouls/p/3369652.html
Copyright © 2011-2022 走看看