Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-03-2010, 04:14 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 8
Chuckmist3r is on a distinguished road
Question reusing a pointer - help

This is the last roadblock in my development, and hopefully with this question answered I will be able to push my app through to the testing/debugging phase.

I need to reuse a pointer I have declared in my header file, after allocating, and initializing the pointer, I now need to initialize the pointer without releasing it, I am not sure on how to do this, or if it is even possible, but I (in theory) need to de-initialize the pointer, than re-initialize with a different pathForResource in this case.

Could you please tell me how to do this? I have gone through apple's developer website, and that's about as much help as reading nutrition facts to find the information I need.

Thank you for your insight,
Charles
Chuckmist3r is offline   Reply With Quote
Old 08-03-2010, 04:23 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

You never release a pointer. You only release the thing it is pointing at. When you say:

Code:
  [str release];
where str is declared as NSString *str; then you are actually releasing the NSString that str is pointing at. If two pointer point to the same object, such as:

Code:
  NSString *str1;
  NSString *str2;
   str1 = [[NSString alloc] initWithString @"Bob"];
   str2 = str1;
then if you did a [str1 release], that is the same thing as a [str2 release]; Only the object is released, not the pointer.

So would you like to rephrase your question and show what you are trying to do?
RLScott is offline   Reply With Quote
Old 08-03-2010, 04:38 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 8
Chuckmist3r is on a distinguished road
Talking

Actually, what you just said led to me thinking, I think you inadvertently answered my question. My problem was with my pointer itself, instead of the path it was looking at, I had the instance pointer acting as a local pointer, so when trying to modify the pointer, I was changing everything connected to it (as to be expected).

If you answered it on purpose or not, is a mystery, but Thank you very much,
Charles

Edit:
Just as I thought, after reading your code post, I decided to create a local pointer, so that I can set it equal to my instance pointer. After I edited my code, it all worked and fell into place, thank you again.

Last edited by Chuckmist3r; 08-03-2010 at 04:48 PM. Reason: Update
Chuckmist3r is offline   Reply With Quote
Reply

Bookmarks

Tags
mpmovieplayercontroller, pointer, problem

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 330
8 members and 322 guests
alexP, gordo26, headkaze, mistergreen2011, nobstudio, rayjeong, Sloshmonster, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0