Passing address of non-local object to __autoreleasing parameter for write-back
2017-04-19 13:01
471 查看
在希望通过函数的參数返回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()
- Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
- 错误:*** -[NSUserDefaults setObject:forKey:]: attempt to insert non-property list object
- 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解决方法
- Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added
- Linux环境下C3P0 Failed to get local InetAddress for VMID 解决办法
- Github遇到Permanently added the RSA host key for IP address '192.30.252.128' to the list of known host
- Notice: Trying to get property of non-object problem(PHP)解决办法
- Failed to get local InetAddress for VMID
- NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: WebKitLocalStorageDatabasePathPreferenc
- Write Code As If You Had to Support It for the Rest of Your Life
- 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 "."
- 论文笔记之:Let there be Color!: Joint End-to-end Learning of Global and Local Image Priors for Automatic