Passing address of non-local object to _autoreleasing parameter for write-back
http://233.io/article/1031248.html
Passing address of non-local object to __autoreleasing parameter for write-back
在希望通过函数的参数返回Objective-C对象的时候,遇到了这个问题
错误代码如下:
- (void)methodA:(NSString **)string<span style="white-space:pre"> </span>// 其实,这里的参数实际类型是:(NSString * __autoreleasing * )string
{
*string = XXX;
}
正确的用法是
- (void)methodA:(NSString * __strong *)string
{
*string = XXX;
}
调用的时候:
NSString *strongString;
[object methodA:&strongString];
Ref:
1.
http://blog.csdn.net/chuanyituoku/article/details/17371807
我的这篇文章的最后部分:
Returning a Result as the Argument
有详细介绍 (看过一遍、并且理解 其实是远远不够的,要吃过苦头才能记牢。。。)
2.
http://codego.net/402513/
Passing address of non-local object to _autoreleasing parameter for write-back的更多相关文章
- Appium - multiprocessing.pool.MaybeEncodingError-【 “Can’t pickle local object ‘PoolManager.__init__.<locals>.<lambda>‘】
公司同事学习自动化新装环境后,run多进程测试用例时出错: multiprocessing.pool.MaybeEncodingError: Error sending result: ’<ap ...
- dill:解决python的“AttributeError: Can't pickle local object”及无法pickle lambda函数的问题
python的pickle是用来序列化对象很方便的工具,但是pickle对传入对象的要求是不能是内部类,也不能是lambda函数. 比如尝试pickle这个内部类: 结果会报错AttributeErr ...
- Can't pickle local object '_createenviron.<locals>.encodekey'报错解决
关于selenium传参报错问题,用下面是报错信息: Traceback (most recent call last): File "D:/code/read_book/main.py&q ...
- Passing address of non-local object to __autoreleasing parameter for write-back
在希望通过函数的參数返回Objective-C对象的时候.遇到了这个问题 错误代码例如以下: - (void)methodA:(NSString **)string<span style=&qu ...
- How do I use a host name to look up an IP address?
The InetAddress class can be used to perform Domain Name Server (DNS) lookups. For example, you can ...
- Directive Definition Object
不知道为什么这个我并没有想翻译过来的欲望,或许我并没有都看熟透,不好误人子弟,原版奉上. Here's an example directive declared with a Directive D ...
- Lingo (Spring Remoting) : Passing client credentials to the server
http://www.jroller.com/sjivan/entry/lingo_spring_remoting_passing_client Lingo (Spring Remoting) : P ...
- Python中的passed by assignment与.NET中的passing by reference、passing by value
Python文档中有一段话: Remember that arguments are passed by assignment in Python. Since assignment just cre ...
- Object Oriented Programming python
Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...
随机推荐
- Aizu:2200-Mr. Rito Post Office
快递 Time limit 8000 ms Memory limit 131072 kB Problem Description 你是某个岛国(ACM-ICPC Japan)上的一个苦逼程序员,你有一 ...
- [Codeforces958A2]Death Stars (medium)(字符串+hash)
Description 题目链接 Solution 这里用类似hash的方法将判断2个矩阵是否相同的时间降为O(m),总时间复杂度为O(m3) Code #include <cstdio> ...
- Flask错误收集 【转】
感谢大佬 ---> 原文链接 一.pydev debugger: process XXXXX is connecting 这个错误网上找了很多资料都无法解决,尝试过多种方法后,对我来说,下面这个 ...
- spark发现新词
package com.icklick.spark.wordSegment import org.apache.log4j.{ Level, Logger } import org.apache.sp ...
- erlang节点局域网通信
节点1: F:\WorkSpace\Server\src>erl -name hw@192.168.10.142 -setcookie 4213 consulting .erlang in &q ...
- 《Cracking the Coding Interview》——第3章:栈和队列——题目4
2014-03-18 05:28 题目:你肯定听过汉诺威塔的故事:三个柱子和N个从小到大的盘子.既然每次你只能移动放在顶上的盘子,这不就是栈操作吗?所以,请用三个栈来模拟N级汉诺威塔的玩法.放心,N不 ...
- 【Validation】林轩田机器学习基石
这一节主要讲如何通过数据来合理的验证模型好不好. 首先,否定了Ein来选模型和Etest来选模型. (1)模型越复杂,Ein肯定越好:但是Eout就不一定了(见上一节的overfitting等) (2 ...
- CSS简易学习笔记
学习地址:http://www.w3school.com.cn/css/index.asp cnblog不能把格式复制上来,有格式文字版:https://github.com/songzhenhua/ ...
- python练习题及实现--文件处理、date日期
练习题作者:Vamei 出处:http://www.cnblogs.com/vamei http://www.cnblogs.com/vamei/archive/2012/07/19/2600135. ...
- Android之SQLite总结
SQLite 是一个轻量级的数据库,常用于各种嵌入式设备当中.android 提供了SQLiteOpenHelper的抽象类用于帮助开发数据库.在实际使用中经常定义一个类继承SQLiteOpenHel ...