OK.
the double initialization was the problem.
the first init was giving me a pointer, and the second one was
returning nothing because the file did not exist,
and i guess the compiler was reusing it...
the problem was fixed like this, sorry for the confusion guy's and
thanks for the help.
I guess it's past my bed time...
NSFileManager *fileManager;
fileManager = [NSFileManager defaultManager];
if ( [fileManager fileExistsAtPath:[[self applicationSupportFolder]
stringByAppendingPathComponent:@"Bonjour Mounter.plist"]
isDirectory:NULL] ) {
mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self
applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour
Mounter.plist"]];
}
else{
mounts = [[NSMutableArray alloc] init];
}
On 17-Nov-08, at 12:52 AM, Sandro Noel wrote:
as it turns out. with the bug fixed the mounts array is left null
because the file does not exist yet.
so further in the program is i try to add to the array, nothing
happens.
and if i try "mounts = [[NSMutableArray alloc] init];" only the two
arrays get the same pointer.
transportTypes = [NSArray
arrayWithObjects:@"afp",@"smb",@"cifs",@"nfs",nil];
mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self
applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour
Mounter.plist"]];
bonjourServices = [[NSMutableArray alloc]init];
AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];
AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;
[AFPScanner searchForService:@"_afpovertcp._tcp." domain:nil];
[SMBScanner searchForService:@"_smb._tcp." domain:nil];
[NFSScanner searchForService:@"_nfs._tcp." domain:nil];
}
return self;
}
On 17-Nov-08, at 12:47 AM, Charles Steinman wrote:
Have you fixed the [mounts initWithContentsOfFile:...] bug and it
still happens?
Cheers,
Chuck
----- Original Message ----
From: Sandro Noel <[EMAIL PROTECTED]>
To: Scott Ribe <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, November 16, 2008 9:16:15 PM
Subject: Re: Two arrays sharing the same adress space.
I'm actually checking here in this function.
- (IBAction)mountSomeServers:(id)sender
{
NSDictionary *mountDictionary;
mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[server stringValue], ServerNameKey,
[share stringValue], VolumeNameKey,
[type title], TransportNameKey,
@"", MountDirectoryKey,
[user stringValue], UserNameKey,
[password stringValue], PasswordKey,
[NSNumber numberWithBool:YES], AsyncKey, NULL];
[mounts addObject:mountDictionary];
this is the only place where objects are being added to the mount
array.
I checked the init function and as soon as the bonjourServices
array is
initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what
i can deduce
it's because the mounts array is empty
at the time, because the file it is trying to load does not exist
yet.
I'm just guessing here, I've never encountered that kind of
problem in 17 years
of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem
in any of my
other cocoa programs.
Sandro Noel.
On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:
This is a debug built, and I'm checking in the code where mounts
is
being assigned objects
Which, if I recall correctly, is before bonjourServices is
allocated. What
do you think the problem is?
--Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/acharlieblue%40yahoo.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel%40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]