Passing address of non-local object to __autoreleasing parameter for write-back
2014-07-28 11:46
781 查看
在希望通过函数的参数返回Objective-C对象的时候,遇到了这个问题
错误代码如下:
正确的用法是
调用的时候:
Ref:
1.
http://blog.csdn.net/chuanyituoku/article/details/17371807
我的这篇文章的最后部分:
Returning a Result as the Argument
有详细介绍 (看过一遍、并且理解 其实是远远不够的,要吃过苦头才能记牢。。。)
2.
http://codego.net/402513/
错误代码如下:
- (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
- Passing address of non-local object to _autoreleasing parameter for write-back
- Passing a list of objects from view to controller via jquery ajax(Json(aspx) -> object(C#))
- Call to member function of non-object: setDebug()
- Linux环境下C3P0 Failed to get local InetAddress for VMID 解决办法
- Notice: Trying to get property of non-object problem(PHP)解决办法 中间件只能跳转不能返任何数据
- 论文笔记之:Let there be Color!: Joint End-to-end Learning of Global and Local Image Priors for Automatic
- An error occurred during local report processing.Failed to load expression host assembly. Details: Request for the permission of
- C3P0在Linux下的Failed to get local InetAddress for VMID解决方法
- InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
- Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
- Notice: Trying to get property of non-object problem(PHP)解决办法
- NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: WebKitLocalStorageDatabasePathPreferenc
- Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
- Unable to find a value for "dwmc" in object of class "java.lang.String" using operator "." (null
- Failed to get local InetAddress for VMID. This is unlikely to matter.
- *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value ‘<Student: 0x8399f70>’
- Unable to find a value for "字段名" in object of class java.lang.String using operator "."
- Implicit conversion of an Objective-C pointer to '__autoreleasing instancetype *' (aka '__autoreleas
- 错误:*** -[NSUserDefaults setObject:forKey:]: attempt to insert non-property list object