Re: NSFileManager, NSDirectoryEnumerator, and File Attributes

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 1:46 AM, Quincey Morris
quinceymor...@earthlink.net wrote:
 On Mar 25, 2011, at 22:38, Jeffrey Walton wrote:

 I'm interested in retrieving attributes of a file (extension, size,
 and modified). NSFileManager will fetch a NSDirectoryEnumerator. From
 NSDirectoryEnumerator, I can get a dictionary of attributes.

 Where does one find a list of keys for the dictionary? I did not see
 it listed in Apple's documentation [1,2,3].

 Documented here:

        
 http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html%23//apple_ref/doc/constant_group/File_Attribute_Keys

 You can get there via a 2-link jump from NSDirectoryEnumerator, but you have 
 to look carefully for the first key. :)
Got it - thanks. Not sure how I missed it (where are my glasses).
___

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 arch...@mail-archive.com


Re: Mutable and immutable class cluster implementation / method swizzling question

2011-03-26 Thread Eli Bach

On Mar 25, 2011, at 12:43 AM, John Engelhart wrote:

 Again, thanks for your suggestion, it's just some factors that were probably
 non-obvious from my message make this particular approach less desirable
 than it otherwise would be.

Well, if you want to release it to others, making it as simple as possible for 
them, you could write a 'publish' script that replaces the #include blah.i 
with the contents of the '.i' file as necessary.

Eli___

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 arch...@mail-archive.com


Re: Hash Values in Custom Classes

2011-03-26 Thread Mike Abdullah

On 26 Mar 2011, at 01:23, Peter Lübke wrote:

 Thank you, Mike, for showing me I was taken away by my own fantasy about 
 hash...
 
 Am 26.03.2011 um 01:22 schrieb Mike Abdullah:
 
 It sounds like you're rather misunderstanding what -hash does. Cocoa classes 
 are free to cover the full range of possible hash values.
 
 In the meantime, I read some related posts on the list and had to recognize 
 this, too...Sorry, this was the first time I was looking at hash values at 
 all.
 
 You can't have a value that interferes with the framework; at worse you 
 could reduce performance IF putting custom objects in the same container as 
 framework-provided classes. Even then you'd be hard-pressed to do this 
 regularly.
 
 To be more detailed: my custom class and its subclasses are wrapper classes 
 containing file informations. They are based on FSRef rather than using paths 
 - I do a lot of lengthy iterations so paths are much too fragile. I also 
 heavily use NSSet to store instances, and I wanted -isEqual: to be as fast as 
 possible. So I thought I could just return a unique hash value for each 
 custom class and return (FSCompareFSRefs (ownRef, otherRef) == noErr) for 
 -isEqual:, thus avoiding the need to *first* compare the objects' classes.

This is pretty much what NSSet will be doing for you. It uses -hash to narrow 
down possible matches, before calling -isEqual: only on those that share a hash.

You should find this plenty enough fast enough if your hash values actually are 
unique. If not, about the only optimization from there is a NSHashTable or 
CFSet setup to test equality on 
-hash.___

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 arch...@mail-archive.com


Re: copyPath:toPath:handler: more reliable than copyItemAtPath:toPath:error: ???

2011-03-26 Thread Matt Neuburg
On Fri, 25 Mar 2011 12:08:53 -0700, Laurent Daudelin laur...@nemesys-soft.com 
said:

I've been trying to copy items from a local disk to an AFP-mounted volume with 
copyItemAtPath:toPath:error: and I found it to be unreliable in the sense 
that it will fail to set the modification date of the item copied to match 
that of the original item. It doesn't report any error, just silently 
continues.


I'm curious as to how performFileOperation:source:destination:files:tag: does 
with this. But I don't hold out much hope.

Also, cp now handles resource forks okay, and it has a -p option that preserves 
dates. So that might be another thing to try.

In my own application, which relies on mod dates (it syncs folders), I had so 
much trouble with all this that in the end I resorted to Apple events telling 
the Finder to perform the copy - and then more Apple events to fix the mod 
dates afterwards. In recent versions of the system I've been able to eliminate 
the mod date fixing part; the Finder now gets this right. Of course this relies 
on the Finder running.

Still, wasn't the big advertisement for copyItemAtPath supposed to be that it 
does the same thing the Finder does? So if it fails to do that, that would be a 
bug.

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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 arch...@mail-archive.com


doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
Hi All,

I have a protocol and declarations as follows. respondsToSeletor
returns NO. If I ignore respondsToSeletor (and send the message), I
get an expeption.

// FilePicker.m - try both
BOOL responds = [delegate respondsToSelector:@selector(userSelectedFile:)];
BOOL responds = [delegate
respondsToSelector:@selector(userSelectedFile:fileSystemObject:suppliedContext:)];

Any ideas on my error(s)? I can't seem to locate it (or them) on my own.

Jeff

// FilePicker.h
@protocol FilePickerDelegate NSObject
@required

// Delegate method called when the user selects a file in the picker.
- (void) userSelectedFile:(FilePicker*)picker
fileSystemObject:(FileSystemObject*)fso
suppliedContext:(NSUInteger)context;
// Delegate method called when the user cancels the picker.
- (void) userSelectedCancel:(FilePicker*)picker
suppliedContext:(NSUInteger)context;

@end

@interface FilePicker : UIViewController
UIPickerViewDelegate, UIPickerViewDataSource
{
...
idFilePickerDelegate delegate;
NSUInteger context;
}

@property (assign, nonatomic) id delegate;
@property (assign, nonatomic) NSUInteger context;
...

// FilePicker.m
// Designated initializer
// pickerDelegate is the callback when the user selects 'Cancel' or
'Done'. The delegate is not retained.
// pickerContext is a user supplied context. Its is passed back to the
delegate (and unused by this class). The context is not retained.
- (id)initWithDelegate:(idFilePickerDelegate)pickerDelegate
withContext:(NSUInteger)pickerContext
{
if(![super init])
return nil;

self.delegate = pickerDelegate;
self.context = pickerContext;

return self;
}

// MyViewController.h
@interface MyViewController : UIViewController
FilePickerDelegate
{
...
}

// MyViewController.m
FilePicker* picker = [[FilePicker alloc] initWithDelegate:self withContext:0];
[self presentModalViewController:picker animated:YES];
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Kyle Sluder
On Sat, Mar 26, 2011 at 6:39 PM, Jeffrey Walton noloa...@gmail.com wrote:
 // FilePicker.m - try both
 BOOL responds = [delegate respondsToSelector:@selector(userSelectedFile:)];
 BOOL responds = [delegate
 respondsToSelector:@selector(userSelectedFile:fileSystemObject:suppliedContext:)];

You need to provide context for this code, and you need to post the
entire exception and stack trace. Are you sure you're even messaging a
FilePickerDelegate?

--Kyle Sluder
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Sherm Pendley
On Sat, Mar 26, 2011 at 9:39 PM, Jeffrey Walton noloa...@gmail.com wrote:

 I have a protocol and declarations as follows. respondsToSeletor
 returns NO. If I ignore respondsToSeletor (and send the message), I
 get an expeption.

 // FilePicker.m - try both
 BOOL responds = [delegate respondsToSelector:@selector(userSelectedFile:)];
 BOOL responds = [delegate
 respondsToSelector:@selector(userSelectedFile:fileSystemObject:suppliedContext:)];

 Any ideas on my error(s)? I can't seem to locate it (or them) on my own.

 // MyViewController.h
 @interface MyViewController : UIViewController
        FilePickerDelegate
 {
    ...
 }

 // MyViewController.m
 FilePicker* picker = [[FilePicker alloc] initWithDelegate:self withContext:0];
 [self presentModalViewController:picker animated:YES];

Okay, I see where you've declared MyViewController as implementing the
FilePickerDelegate protocol - but where are the method
implementations? You *have* implemented those methods, right?

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 9:56 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 6:39 PM, Jeffrey Walton noloa...@gmail.com wrote:
 // FilePicker.m - try both
 BOOL responds = [delegate respondsToSelector:@selector(userSelectedFile:)];
 BOOL responds = [delegate
 respondsToSelector:@selector(userSelectedFile:fileSystemObject:suppliedContext:)];

 You need to provide context for this code, and you need to post the
 entire exception and stack trace. Are you sure you're even messaging a
 FilePickerDelegate?
I believe so, since MyViewController is declared as a
FilePickerDelegate. When MyViewController instance creates a picker,
it does so as follows:

// MyViewController.m. MyViewController is a FilePickerDelegate.
- (void) changeSrcFileTapped:(id)sender
{
FilePicker* picker = [[FilePicker alloc] initWithDelegate:self
withContext:0];
[self presentModalViewController:picker animated:YES];
}

Back trace is below. Its basically useless to me since there is a call
graph, but very few symbols (I did a full install of Xcode???).

Is there anything special that needs to be done with IB? Perhaps a
missing IBOutlet?

Thanks for any help.

Jeff

(gdb) continue
2011-03-26 22:12:50.029 CryptoSandbox[123:707] -[UIView
userSelectedFile:fileSystemObject:suppliedContext:]: unrecognized
selector sent to instance 0x1dbd00
2011-03-26 22:12:50.051 CryptoSandbox[123:707] *** Terminating app due
to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView
userSelectedFile:fileSystemObject:suppliedContext:]: unrecognized
selector sent to instance 0x1dbd00'
*** Call stack at first throw:
(
0   CoreFoundation  0x329af64f 
__exceptionPreprocess + 114
1   libobjc.A.dylib 0x31b23c5d objc_exception_throw 
+ 24
2   CoreFoundation  0x329b31bf
-[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3   CoreFoundation  0x329b2649 ___forwarding___ + 
508
4   CoreFoundation  0x32929180 
_CF_forwarding_prep_0 + 48
5   CryptoSandbox   0x65e1 -[FilePicker
doneButtonPressed:] + 504
6   CoreFoundation  0x3291f571
-[NSObject(NSObject) performSelector:withObject:withObject:] + 24
7   UIKit   0x32cd0ec9 -[UIApplication
sendAction:to:from:forEvent:] + 84
8   UIKit   0x32d5dc21
-[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 92
9   CoreFoundation  0x3291f571
-[NSObject(NSObject) performSelector:withObject:withObject:] + 24
10  UIKit   0x32cd0ec9 -[UIApplication
sendAction:to:from:forEvent:] + 84
11  UIKit   0x32cd0e69 -[UIApplication
sendAction:toTarget:fromSender:forEvent:] + 32
12  UIKit   0x32cd0e3b -[UIControl
sendAction:to:forEvent:] + 38
13  UIKit   0x32cd0b8d
-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
14  UIKit   0x32cd1423 -[UIControl
touchesEnded:withEvent:] + 342
15  UIKit   0x32ccfbf5 -[UIWindow
_sendTouchesForEvent:] + 368
16  UIKit   0x32ccf56f -[UIWindow 
sendEvent:] + 262
17  UIKit   0x32cb8313 -[UIApplication
sendEvent:] + 298
18  UIKit   0x32cb7c53
_UIApplicationHandleEvent + 5090
19  GraphicsServices0x30e97e77 PurpleEventCallback 
+ 666
20  CoreFoundation  0x32986a97
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
21  CoreFoundation  0x3298883f __CFRunLoopDoSource1 
+ 166
22  CoreFoundation  0x3298960d __CFRunLoopRun + 520
23  CoreFoundation  0x32919ec3 CFRunLoopRunSpecific 
+ 230
24  CoreFoundation  0x32919dcb CFRunLoopRunInMode + 
58
25  GraphicsServices0x30e9741f GSEventRunModal + 114
26  GraphicsServices0x30e974cb GSEventRun + 62
27  UIKit   0x32ce2d69 -[UIApplication 
_run] + 404
28  UIKit   0x32ce0807 UIApplicationMain + 
670
29  CryptoSandbox   0x54d7 main + 74
30  CryptoSandbox   0x2b8c start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.
Current language:  auto; currently objective-c
(gdb) bt full
#0  0x33062a1c in __pthread_kill ()
No symbol table info available.
#1  0x339ff3ba in pthread_kill ()
No symbol table info available.
#2  0x339f7bfe in abort ()
No symbol table info available.
#3  0x3134da6a in 

Re: doesNotRecognizeSelector exception

2011-03-26 Thread Sherm Pendley
On Sat, Mar 26, 2011 at 10:21 PM, Jeffrey Walton noloa...@gmail.com wrote:

 2011-03-26 22:12:50.029 CryptoSandbox[123:707] -[UIView
 userSelectedFile:fileSystemObject:suppliedContext:]: unrecognized
 selector sent to instance 0x1dbd00

The delegate message is being sent to an instance of UIView - not to
your controller. That would indicate that the first argument you're
sending to -initWithDelegate:withContext: is not what it should be.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Kyle Sluder
On Sat, Mar 26, 2011 at 7:35 PM, Sherm Pendley sherm.pend...@gmail.com wrote:
 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.

Or nobody's retaining the delegate, and therefore it's being replaced
in memory with the UIView instance. The reason delegates are
unretained in Cocoa is because they typically have a strong reference
to the thing they are a delegate of.

--Kyle Sluder
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Kyle Sluder
I'm on the road so i cant discuss this further right now. One reason it's more 
helpful to keep this discussion on-list. :)

--Kyle Sluder
(Sent from the road)

On Mar 26, 2011, at 8:23 PM, Jeffrey Walton noloa...@gmail.com wrote:

 On Sat, Mar 26, 2011 at 11:01 PM, Jeffrey Walton noloa...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 10:37 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 7:35 PM, Sherm Pendley sherm.pend...@gmail.com 
 wrote:
 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.
 
 Or nobody's retaining the delegate, and therefore it's being replaced
 in memory with the UIView instance. The reason delegates are
 unretained in Cocoa is because they typically have a strong reference
 to the thing they are a delegate of.
 Correct: the file picker is not retaining the delegate (per Hillegass
 and retain loop/cycle).
 
 Should the delegate be retained by FilePicker? In this case, to avoid
 the retain loop, MyViewController *should not* retain the FilePicker?
 Changing the code so that the FilePicker retained the delegate did not help.
 
 Jeff
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 11:26 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 I'm on the road so i cant discuss this further right now. One reason it's 
 more helpful to keep this discussion on-list. :)

 --Kyle Sluder
My Bad. I sometimes forget that GMail does not perform a 'Reply All' by default.

Jeff


 On Mar 26, 2011, at 8:23 PM, Jeffrey Walton noloa...@gmail.com wrote:

 On Sat, Mar 26, 2011 at 11:01 PM, Jeffrey Walton noloa...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 10:37 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 7:35 PM, Sherm Pendley sherm.pend...@gmail.com 
 wrote:
 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.

 Or nobody's retaining the delegate, and therefore it's being replaced
 in memory with the UIView instance. The reason delegates are
 unretained in Cocoa is because they typically have a strong reference
 to the thing they are a delegate of.
 Correct: the file picker is not retaining the delegate (per Hillegass
 and retain loop/cycle).

 Should the delegate be retained by FilePicker? In this case, to avoid
 the retain loop, MyViewController *should not* retain the FilePicker?
 Changing the code so that the FilePicker retained the delegate did not help.

 Jeff

___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 10:35 PM, Sherm Pendley sherm.pend...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 10:21 PM, Jeffrey Walton noloa...@gmail.com wrote:

 2011-03-26 22:12:50.029 CryptoSandbox[123:707] -[UIView
 userSelectedFile:fileSystemObject:suppliedContext:]: unrecognized
 selector sent to instance 0x1dbd00

 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.

I'm not sure what its being sent to. below, I changed 'delegate' to
'callbackDelegate' in case of a hidden name clash. Then I put in a few
NSLogs. The message is clearly not being sent to the delegate that was
init'd in the picker. The delegate changes from 0x1434b0 to 0x1283d0.

WTF?

Jeff

2011-03-26 23:21:17.564 MyTestApp[233:707]
EncryptFileController::changeSrcFileTapped: self = 0x1434b0
2011-03-26 23:21:17.566 MyTestApp[233:707]
EncryptFileController::changeSrcFileTapped: FilePicker = 0x159800
2011-03-26 23:21:17.548 MyTestApp[233:707]
FilePicker::initWithDelegate: self = 0x159800
2011-03-26 23:21:17.557 MyTestApp[233:707]
FilePicker::initWithDelegate: delegate = 0x1434b0
2011-03-26 23:21:20.279 MyTestApp[233:707]
FilePicker::doneButtonPressed: delegate = 0x1283d0
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 10:37 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 7:35 PM, Sherm Pendley sherm.pend...@gmail.com 
 wrote:
 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.

 Or nobody's retaining the delegate, and therefore it's being replaced
 in memory with the UIView instance. The reason delegates are
 unretained in Cocoa is because they typically have a strong reference
 to the thing they are a delegate of.
Correct: the file picker is not retaining the delegate (per Hillegass
and retain loop/cycle).

Should the delegate be retained by FilePicker? In this case, to avoid
the retain loop, MyViewController *should not* retain the FilePicker?
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 11:30 PM, Jeffrey Walton noloa...@gmail.com wrote:
 On Sat, Mar 26, 2011 at 10:35 PM, Sherm Pendley sherm.pend...@gmail.com 
 wrote:
 On Sat, Mar 26, 2011 at 10:21 PM, Jeffrey Walton noloa...@gmail.com wrote:

 2011-03-26 22:12:50.029 CryptoSandbox[123:707] -[UIView
 userSelectedFile:fileSystemObject:suppliedContext:]: unrecognized
 selector sent to instance 0x1dbd00

 The delegate message is being sent to an instance of UIView - not to
 your controller. That would indicate that the first argument you're
 sending to -initWithDelegate:withContext: is not what it should be.

 I'm not sure what its being sent to. below, I changed 'delegate' to
 'callbackDelegate' in case of a hidden name clash. Then I put in a few
 NSLogs. The message is clearly not being sent to the delegate that was
 init'd in the picker. The delegate changes from 0x1434b0 to 0x1283d0.

 WTF?

 Jeff

 2011-03-26 23:21:17.564 MyTestApp[233:707]
 EncryptFileController::changeSrcFileTapped: self = 0x1434b0
 2011-03-26 23:21:17.566 MyTestApp[233:707]
 EncryptFileController::changeSrcFileTapped: FilePicker = 0x159800
 2011-03-26 23:21:17.548 MyTestApp[233:707]
 FilePicker::initWithDelegate: self = 0x159800
 2011-03-26 23:21:17.557 MyTestApp[233:707]
 FilePicker::initWithDelegate: delegate = 0x1434b0
 2011-03-26 23:21:20.279 MyTestApp[233:707]
 FilePicker::doneButtonPressed: delegate = 0x1283d0
I deleted all connections and actions in Interface Builder. I closed
IB and Xcode. I cleaned the project (including the two hidden files in
the xcode.proj director). I reopened the project, and then reconnected
the NIB in IB.

Everything is OK.

WTF???

Jeff
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Quincey Morris
On Mar 26, 2011, at 20:30, Jeffrey Walton wrote:

 I'm not sure what its being sent to. below, I changed 'delegate' to
 'callbackDelegate' in case of a hidden name clash. Then I put in a few
 NSLogs. The message is clearly not being sent to the delegate that was
 init'd in the picker. The delegate changes from 0x1434b0 to 0x1283d0.

This sort of thing can be caused by accidentally having 2 objects where you 
should only have one. For example, if you put a window controller object inside 
the window's nib file, that'll give you an extra window controller beyond the 
one that NSDocument (or the app delegate, depending on the kind of application) 
creates for you.

They duel for a while, and then one of them possibly goes away because it's 
unreferenced.

Why on earth aren't you using the debugger to track this down? Logging pointers 
is fine up to a point, but if you need to poke around to see if outlets are 
connected to what objects, it's a terribly inefficient way to debug.


___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Jeffrey Walton
On Sat, Mar 26, 2011 at 11:48 PM, Quincey Morris
quinceymor...@earthlink.net wrote:
 On Mar 26, 2011, at 20:30, Jeffrey Walton wrote:

 I'm not sure what its being sent to. below, I changed 'delegate' to
 'callbackDelegate' in case of a hidden name clash. Then I put in a few
 NSLogs. The message is clearly not being sent to the delegate that was
 init'd in the picker. The delegate changes from 0x1434b0 to 0x1283d0.

 This sort of thing can be caused by accidentally having 2 objects where you 
 should only have one. For example, if you put a window controller object 
 inside the window's nib file, that'll give you an extra window controller 
 beyond the one that NSDocument (or the app delegate, depending on the kind of 
 application) creates for you.

 They duel for a while, and then one of them possibly goes away because it's 
 unreferenced.

 Why on earth aren't you using the debugger to track this down? Logging 
 pointers is fine up to a point, but if you need to poke around to see if 
 outlets are connected to what objects, it's a terribly inefficient way to 
 debug.

Agreed. I don't have enough experience with Xcode and Cocoa yet to
know how to [correctly?] approach a problem. That, coupled with lack
of symbols, is crippling. It did not help that GDB's 'po' command
claimed the address was not even an object!

Jeff
___

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 arch...@mail-archive.com


Re: doesNotRecognizeSelector exception

2011-03-26 Thread Quincey Morris
On Mar 26, 2011, at 20:46, Jeffrey Walton wrote:

 I deleted all connections and actions in Interface Builder. I closed
 IB and Xcode. I cleaned the project (including the two hidden files in
 the xcode.proj director). I reopened the project, and then reconnected
 the NIB in IB.
 
 Everything is OK.


Possibly. Or possibly it's still wrong and there are multiple controllers, but 
by chance things are happening in a different order now, and so it works by 
accident.

On Mar 26, 2011, at 20:52, Jeffrey Walton wrote:

 It did not help that GDB's 'po' command
 claimed the address was not even an object!


For all its faults I've never see GDB lie about something like that. If it said 
so, I'd believe it.

If it was a *recently deallocated* object, the block of free memory may still 
look enough like an object for it to (for example) report that it has a class.


___

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 arch...@mail-archive.com