11-19-2010, 01:17 PM
#1 (permalink )
Registered Member
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
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.
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
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.
11-19-2010, 02:12 PM
#3 (permalink )
Registered Member
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
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];
11-19-2010, 08:23 PM
#4 (permalink )
Cocoa Junkie
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Quote:
Originally Posted by
selim.aksoy
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.
11-20-2010, 05:16 AM
#5 (permalink )
Registered Member
Join Date: Oct 2010
Location: Istanbul/Turkey
Posts: 7
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
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
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80