Questions tagged [copywithzone]

34 questions
1
vote
3 answers

copy one NSString to another

How to copy one NSString to another? @interface MyData : NSObject { @private //user's private info NSInteger uID; NSString *name; NSString *surname; NSString *email; NSString *telephone; //user's picture …
yozhik
  • 4,644
  • 14
  • 65
  • 98
1
vote
0 answers

Memory Leak when running: [[GKMatchmakerViewController alloc] initWithMatchRequest:request]

I'm testing my Objective C project for memory leaks using xCode Instruments tool. The following lines (in my procedure to find matches in Game Center) are generating a Memory Leak: GKMatchRequest *request = [[GKMatchRequest alloc]…
Pablo Alfonso
  • 2,317
  • 1
  • 18
  • 24
1
vote
0 answers

Swift: ObjectiveC RunTime unrecognized copyWithZone error for value types

I am looking to migrate some code from Swift -> Objective C starting with unit tests. I am having issues with mocking functions that passes value types: let initWithTitleBlock : @objc_block (String, String) -> AlertViewMock! = { (title : String,…
Jason Hu
  • 11
  • 1
1
vote
1 answer

copywithzone exception on object not included in current class

I am using a 4 UIButton that bring up the same UIPickerView but with different NSArray(4) appearing for each button. Using a 4 bool to let the UIPickerView to decide which to load, and which row's text to grab. The buttons methods just include the…
cmario
  • 605
  • 1
  • 7
  • 22
1
vote
0 answers

iOS Copying a custom object

I load a custom object using : NSArray* array = [[NSBundle mainBundle] loadNibNamed:@"MyViewItem" owner:nil options:nil]; MyViewItem* myBaseItem = [array objectAtIndex:0]; In order not to perform the loadNibNamed action like a hundred times in the…
Kleioz
  • 294
  • 3
  • 13
0
votes
2 answers

How can i copy a MutableArray in the same zone as the old one?

How can i add a mutable array in the same like the old one? I tried this code but it doesn't work: - (void)didParsingApiBusinesses:(NSMutableArray *)businesses { NSZone *zone = [entriesBusinessesArray zone]; entriesBusinessesArray =…
keep on you
  • 310
  • 6
  • 21
0
votes
1 answer

NSCopying and copyWithZone: - should they return [self retain] or something else?

I'm having a hard time understanding copyWithZone. I know it's supposed to return a copy, but if I add an object to a dictionary, it adds a 'copyWithZone' object to the dictionary. If I make an actual copy (that is, a new object), then the object…
AWF4vk
  • 5,810
  • 3
  • 37
  • 70
0
votes
1 answer

NSCell not properly displayed

I have an custom NSCell in an NSTableView and it doesn't display correctly. The table view has the right number of items in it but they're empty except for the first one. The first one shows the cell but its values change randomly when I click…
Jompa
  • 3
  • 2
0
votes
1 answer

iPhone : copyWithZone : releasing an object before its return?

I read in the apple documentation about copyWithZone : "The returned object is implicitly retained by the sender, who is responsible for releasing it". But... How may I release something I return... I'm going crazy ! Sample of code : -…
Oliver
  • 23,072
  • 33
  • 138
  • 230
0
votes
3 answers

IPhone - copyWithZone leak

Testing my app on the device it returns a leak whe i call the copy of a custom object ande i can't understand why. this is the call: NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:5]; for (SinglePart *sp in [copyFrom partList]) { …
w4nderlust
  • 1,057
  • 2
  • 12
  • 22
0
votes
2 answers

mutableCopyWithZone updating a property value

I have a Class that I need to copy with the ability to make changes the value of a variable on both Classes. Simply put these classes need to remain clones of each other at all times. My understanding of the documentation is that I can do this using…
Jim
  • 890
  • 2
  • 10
  • 22
0
votes
0 answers

Copy UICollectionView already created in IB

I am trying to copy a collectionView I did in IB. Is there any quick way I could use to have a deep copy of the collectionView instead of creating it in my code programmatically and adding the cell views. Update 1 : UICollectionView created in my…
Basel JD
  • 275
  • 3
  • 17
0
votes
1 answer

UITableViewCell copyWithZone unrecognized selector sent to instance

I am trying to update the values in my custom tableviewcell (DHtableViewCell) using KVO. I keep getting this error. I am aware that there are others that have this same exception, but their solutions do not help. -[DHTableViewCell copyWithZone:]:…
DerrickHo328
  • 4,664
  • 7
  • 29
  • 50
0
votes
0 answers

error when i want take value core data in iOS

when i want to search core data in map view aim unable to search the data please help me iam getting this error as 2014-02-21 09:43:31.268 naveen[674:a0b] -[Search copyWithZone:]: unrecognized selector sent to instance 0x9a48100 2014-02-21…
0
votes
1 answer

copyWithZone using mogenerator

I'm using Mogenerator to generate my models. So in my Human model I have - (id)copyWithZone:(NSZone *)zone { AppointmentGrid *appointmentGridCopy = [[[self class] allocWithZone:zone] init]; [appointmentGridCopy…
Bot
  • 11,868
  • 11
  • 75
  • 131