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

时间: 2024-09-29 03:59:45

Passing address of non-local object to __autoreleasing parameter for write-back的相关文章

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>

ORA-07445:[kghsrch()+128] [SIGSEGV] [Address not mapped to object]冷处理

客户现场,电信相关7*24h业务,某省份数据库二节点alert不断产生ORA-7445报错,并抛出Trace dump文件.Trc文件.一节点alert并无7445相关报错,仅有core文件产生.crs.syslog等日志无明显告警.没有引起重启,没有引起业务方面的影响.只是不断报错,由于Oracle目录空间40G,为了防止数据库实例夯死,客户还是决定解决该报错. 客户主机HP-UX B.11.31 ia64,Oracle Release 10.2.0.5.0. 节点二alert: Thu No

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 call the static InetAddress.getByName("www.teamcakes.com") to retrieve an InetAddress object for 'www.teamcakes.com'. This object would contain t

NAT (Network Address Translation)

NAT Introduction NAT: Provides the translation of private address to public address. ? NAT has many uses, but its primary use is to conserve public IPv4 addresses. It does this by allowing networks to use private IPv4 addresses internally and providi

Parse Local Datastore

Parse Local Datastore 简介 翻译 Pinning Retrieving Objects Querying Security Unpinning Pinning with Labels Caching Query Results Syncing Local Changes 说明 简介 本文翻译了Parse关于本地存储的部分,链接如下:Parse Local Datastore 翻译 The Parse iOS/OSX SDK provides a local datastor

Object Oriented Programming python

new concepts of the object oriented programming : class encapsulation inheritance polymorphism the three features of an object are : identity, state and behaviora class is an abstraction which regroup objects who have the same attributes and the same

Object Creation

Although using the object constructor or an object literal are convenient ways to create single objects, there is an obvious downside: creating multiple objects with the same interface requires a lot of code duplication. To solve this problem, develo

Security10:Grant object Permission to DB Role or User

1,将访问Object的权限授予Database Role 或 User 的语法如下 GRANT <permission> [ ,...n ] ON [ OBJECT :: ][ schema_name ]. object_name [ ( column [ ,...n ] ) ] TO [Database_user | Database_role] [ ,...n ] [ WITH GRANT OPTION ] An object is a schema-level securable co

werkzeug(flask)中的local,localstack,localproxy探究

1.关于local python中有threading local处理方式,在多线程环境中将变量按照线程id区分 由于协程在Python web中广泛使用,所以threading local不再满足需要 local中优先使用greenlet协程,其次是线程id,如下所示: try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except Im