【发布时间】:2018-06-10 11:29:45
【问题描述】:
假设我将 c++ 函数与 Objective-c 成员结合在一起。
该函数获取std::string并将其转换为NSstring*,并在离开之前使用此变量...
我应该期待NSstring* 在autoreleasepool 范围结束时发布吗?
void myclass::myfunc(context& ctx)
{
@autoreleasepool
{
std::string path = ctx.getData().path;
NSString *nsPath = [NSString stringWithUTF8String:path.c_str()];
... (do something with nsString, Should it be released after leaving the scope ?)
}
}
【问题讨论】:
标签: objective-c nsautoreleasepool