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 11-19-2010, 01:17 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
selim.aksoy is on a distinguished road
Default how can i access NSMutableDictionary from another class

can you help me , how can i access NSMutableDictionary from another class?

I tried but i couldnt do it. thank you.
selim.aksoy is offline   Reply With Quote
Old 11-19-2010, 02:03 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Well how did you try? Perhaps you were close, but just missed it. Perhaps you were far? Perhaps you didnt even try? Can you post the code please?

Also, this question has been asked and answered more times than I can count. Just search this forum.
smithdale87 is offline   Reply With Quote
Old 11-19-2010, 02:12 PM   #3 (permalink)
Registered Member
 
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
selim.aksoy is on a distinguished road
Default

it is easy but i coulnt find example in this forum and google

xmlparse.m


if( [elementName isEqualToString:@"AllianceCode"]) {
recordResults = FALSE;
NSLog(@"AllianceCode = %@ \n", soapResults);
[dict setObject:soapResults forKey:@"AllianceCode"];
[soapResults release];
soapResults = nil;
}
else if( [elementName isEqualToString:@"PlayerName"]) {
recordResults = FALSE;
NSLog(@"PlayerName = %@ \n", soapResults);
[dict setObject:soapResults forKey:@"PlayerName"];
[soapResults release];
soapResults = nil;
}

otherclass.m

xmlparse *xml = [[xmlparse alloc]init];
NSArray *userList = [xml.dict allKeys]; ?????? problem here
[xml release];
selim.aksoy is offline   Reply With Quote
Old 11-19-2010, 08:23 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by selim.aksoy View Post
can you help me , how can i access NSMutableDictionary from another class?

I tried but i couldnt do it. thank you.
Make the dictionary a property of FirstClass.

Then in secondClass, get a pointer to your FirstClass object and use the property to retrieve the array:

Code:
@class FirstClass: NSObject
{
  NSArray* anArray;
}

@property (nonatomic, retain) NSArray* anArray;

Then, in SecondClass:

Code:
FirstClass* aFirstClassObject = [[FirstClass alloc] init];
[aFirstClassObject doStuff];  //Sets up an array in anArray
NSArray* theArray = aFirstClassObject.anArray; //There you go.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 11-20-2010, 05:16 AM   #5 (permalink)
Registered Member
 
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
selim.aksoy is on a distinguished road
Default

Duncan, i tried but i am still getting nil value.

SoapWebService.m

Quote:

@interface SoapWebService : UIViewController {
// Request
NSString *address;
NSString *xmlNamespace;
NSString *operation;
NSString *parameters;

// Connection
BOOL recordResults;
BOOL connectionFinished;

// Xml Parsing
NSMutableString *soapResults;
NSMutableData *webData;
NSXMLParser *xmlParser;

NSMutableString *send ;
}

@property(nonatomic, retain) NSString *address;
@property(nonatomic, retain) NSString *xmlNamespace;

@property(nonatomic, retain) NSString *operation;
@property(nonatomic, retain) NSString *parameters
@property(nonatomic, retain) NSMutableString *send ;

SoapWebService.h
Quote:

@synthesize send;

-(void)parserNSXMLParser *)parser didEndElementNSString *)elementName namespaceURINSString *)namespaceURI qualifiedNameNSString *)qName {

if( [elementName isEqualToString:@"PlayerName"]) {
recordResults = FALSE;
NSLog(@"PlayerName = %@ \n", soapResults);
send = soapResults;
[soapResults release];
soapResults = nil;
}
}
I want to get value here

Front.h

Quote:

SoapWebService *service = [[SoapWebService alloc]init];
NSMutableString *strUserName = service.send;
[service release];
strUserName still nil.

I see the value in debugger console
PlayerName = blablabla
selim.aksoy is offline   Reply With Quote
Reply

Bookmarks

Tags
another class, nsmutabledictionary

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: 374
7 members and 367 guests
apatsufas, Kirkout, lzwasyc, MarkC, Sami Gh, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

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