mutableCopyWithZone,复制NSMutableArray?(mutableCopyWithZone, copy NSMutableArray?)
我试图做一个包含5个实例变量的行星对象的mutableCopy(其中之一是一个字符串文字的NSMutableArray。我的问题是,我不确定如何将newPlanet>数据设置为self> data的副本,有道理?
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; // NSMutableArray *data; HOW TO: newPlanet>data = self>data? return(newPlanet); }
EDIT_001:
基于Chuck&bbum的评论,我更新了我的方法并添加了以下内容......
@property(retain) NSMutableArray *data; @synthesize data;
。
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone]; [newPlanet setData: copiedArray]; [copiedArray release]; return(newPlanet); }
非常感激
加里
I a trying to make a mutableCopy of a planet object that contains 5 instance variables (one of them being an NSMutableArray of string literals. My problem is that I am unsure how to set the newPlanet>data to a copy of self>data, does that make sense?
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; // NSMutableArray *data; HOW TO: newPlanet>data = self>data? return(newPlanet); }
EDIT_001:
Based on the comments by Chuck & bbum I updated my method and added the following ...
@property(retain) NSMutableArray *data; @synthesize data;
.
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone]; [newPlanet setData: copiedArray]; [copiedArray release]; return(newPlanet); }
much appreciated
gary
原文:https://stackoverflow.com/questions/2015943
最满意答案
该消息意味着,在管道内的复制活动中,使用typeProperties(源和接收器的对等体)中的executionLocation属性来指定区域,如“executionLocation”:“East US”。 请参阅此处的文档: https : //docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement
The message means, in the copy activity within the pipeline, use the executionLocation property within typeProperties (peer of source and sink) to specify the region, like "executionLocation": "East US". See docs here: https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement
相关问答
更多-
无法检测数据源位置。(Can't detect data source location. Please specify ExecutionLocation in CopyActivity)[2024-01-19]
该消息意味着,在管道内的复制活动中,使用typeProperties(源和接收器的对等体)中的executionLocation属性来指定区域,如“executionLocation”:“East US”。 请参阅此处的文档: https : //docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement The ... -
摆脱“当前位置没有可用的源代码”。(Getting rid of “There is no source code available for the current location.”)[2022-01-14]
查看某些源文件是否被意外排除。 执行解决方案的属性,并查看“常见属性”下的“调试源文件”部分。 See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties. -
不幸的是,这个答案比Crystal Reports&BIRT更适合我们的企业架构。 由于缺乏文档和对内存的普遍依赖,直到今天我才知道所有数据库服务器都在组织的LDAP中注册,并且以这种方式查找。 解释为什么我从来没有看到tnsnames.ora,为什么没有配置信息没有显示在任何地方,但似乎没有被缓存。 世界再次合理。 Unfortunately, this answer has more to do with our Enterprise architecture than Crystal Reports ...
-
首先看一下你的问题似乎问题在于ToText函数,其中参数更多。 您的公式似乎是您在totext中使用dates ,因此请查看文档以更正语法。 http://pic.dhe.ibm.com/infocenter/rsawshlp/v7r5m0/index.jsp?topic=%2Fcom.businessobjects.integration.eclipse.designer.doc%2Fhtml%2Ftopic666.html 如果您正在尝试特定格式...更新您的问题并告诉我 Problem solved. ...
-
希望这会有所帮助,如果不让我知道: 在发布窗口期间检查以下详细信息: 发布设置 - 网站名称与原始名称不同 安全设置 - HTTPS - 确保将此设置为无HTTPS,除非您拥有有效的数字签名 数据连接 - 数据连接 - 选中此项设置为“更新到现有数据库”而不是“生成一个名为”的新数据库。 这很可能是原因,因为默认设置为后者。 数据连接 - 附加数据源 - 检查此不是空白 如果所有这些细节都是正确的让我知道并且生病了再试一次 What I did to get around this was put the ...
-
在“ Azure Blob存储中批量访问数据的示例 ”中,我们可以找到: 从SQL Server批量访问Azure blob存储至少需要SQL Server 2017 CTP 1.1。 在“ 创建外部数据源(Transact-SQL) ”的参数部分中,我们可以找到类似的信息: 使用BULK INSERT或OPENROWSET与SQL Server 2017执行批量操作时使用BLOB_STORAGE 您正在使用SQL Server 2016,因此在为Azure Blob存储创建外部数据源时, Incorrec ...
-
至少在Visual Studio 2013中 ,这里给出的其他答案对我来说并不适用。 我找到了扩展名http://disablenosourcetab.codeplex.com/ 。 它完全禁用了我的选项卡。 At least on Visual Studio 2013 the other answer given here didn't work for me. I've found the extension http://disablenosourcetab.codeplex.com/. It dis ...
-
一种方法是在Localizable.strings编写本地化CSV文件的文件名。 例如,该文件的英文版可以称为CSV_en.txt ,即法文版CSV_fr.txt 。 在英文版的strings文件中,写 "CSV" = "CSV_en"; 在法文版写 "CSV" = "CSV_fr"; 然后,您可以通过以下操作获取本地化的CSV文件: let location = Bundle.main.path(forResource: NSLocalizedString("CSV", comment: ""), o ...
-
dygraph 1.1.1似乎错误地检测到数据源的范围值(dygraph 1.1.1 appears to incorrectly detect range value for data source)[2023-03-03]
正如danvk 建议的那样 ,解决方案是将数字改为用引号括起来,使得它们被视为字符串,只是JSON输出中的裸号。 再次感谢danvk :) 原始文件包含以下部分: "c": [ { "v": "Date(2016, 10, 27, 00, 00, 00)" }, { "v": "548" }, { "v": "165" }, { "v": "57" }, { ... -
如何在Spotfire中找到保存数据源的位置?(How to find the location where data source has been saved in Spotfire?)[2024-03-17]
我刚刚找到这个选项,这实际上是我的问题的答案。 I have just located this option which is infact an answer to my question.