IOS Developer
IOS Developer

Reputation: 77

IOS NSObject Release

I have created a class from NSObject to save my information.

@interface MyInfor : NSObject

+(MyInfor *)Insert_MyName:(NSString *)MyName
                         MyAge:(NSString *)MyAge;

And now, I want to release memory for my class when it's not used.

How to I can do this.

Upvotes: 1

Views: 829

Answers (2)

OliverD
OliverD

Reputation: 884

If ARC is enabled in your project (any newly created projects in the last years do have it enabled by default) there is no need to manually release the memory.

If ARC is not active you have to release the memory where you allocate it. You have to override "dealloc" to release any memory.

If you don't use ARC you should consider reading this: Memory Management

Upvotes: 1

Avi
Avi

Reputation: 7552

When you no longer have any strong references, the object will be released. Read up on ARC (automatic reference counting).

Current link to documentation for ARC is here.

Upvotes: 0

Related Questions