[Unison-hackers] [unison-svn] r476 - in trunk/src: . lwt ubase uimacnew09 uimacnew09/uimacnew.xcodeproj

Benjamin C. Pierce bcpierce at cis.upenn.edu
Sat Jul 30 19:19:56 EDT 2011


Hi,

I'm probably not doing what you intended, but just pasting in the code you sent in place of the existing quitIfBatch leads to these warnings during compilation...

/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m: In function '-[MyController quitIfBatch:]':
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:662: warning: 'MyController' may not respond to '-window'
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:662: warning: (Messages without a matching method signature
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:662: warning: will be assumed to return 'id' and accept
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:662: warning: '...' as arguments.)
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m: In function '-[MyController outlineView:numberOfChildrenOfItem:]':
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:699: warning: conflicting types for '-(int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item'
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:199: warning: previous declaration of '-(NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item'
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m: In function '-[MyController outlineView:child:ofItem:]':
/Users/bcpierce/current/unison/trunk/src/uimacnew09/MyController.m:708: warning: conflicting types for '-(id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item'
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOutlineView.h:197: warning: previous declaration of '-(id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item'

... and these messages before a failure at runtime:

2011-07-30 19:17:09.278 Unison[20964:903] Automatically quitting because of -batch
2011-07-30 19:17:09.282 Unison[20964:903] -[MyController window]: unrecognized selector sent to instance 0x10043e190
2011-07-30 19:17:09.283 Unison[20964:903] -[MyController window]: unrecognized selector sent to instance 0x10043e190

Maybe easier if you just send the whole new MyController.m?

Thanks,

    - B

On Jul 19, 2011, at 3:23 PM, Steve Kalkwarf wrote:

>> If you want to try the committed version …
> 
> 
> MyController.m:630
> 'return' with a value, in function returning void
> 
> Try this code out:
> 
> In MyController.m:
> 
> - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
> {
>    [_timer invalidate];
> 
>    switch (returnCode) {
>        case NSAlertAlternateReturn:
>            return;
>            break;
> 
>        default:
>            NSLog(@"Quit");
>            break;
>    }
> }
> 
> - (void)updateCountdown
> {
>    if (_secondsRemaining == 0) {
>        [_timer invalidate];
>        [[_timeoutAlert window] orderOut: nil];
>        [self alertDidEnd: _timeoutAlert returnCode: NSAlertDefaultReturn contextInfo: nil];
>    } else {
>        [_timeoutAlert setMessageText: [NSString stringWithFormat: @"Unison will quit in %lu seconds", _secondsRemaining]];
>        _secondsRemaining--;
>    }
> }
> 
> - (void)quitIfBatch:(id)ignore
> {
> 	if (isBatchSet) {
> 		NSLog(@"Automatically quitting because of -batch");
>        _timeoutAlert = [NSAlert alertWithMessageText: @"" defaultButton: @"Quit" alternateButton: @"Cancel" otherButton: nil informativeTextWithFormat: @""];
> 
>        _secondsRemaining = 10;
> 
>        _timer = [NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @selector(updateCountdown) userInfo: nil repeats: YES];
> 
>        [_timeoutAlert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:) contextInfo: NULL];
>    }
> }
> 
> ===
> 
> In MyController.h, add these iVars:
> 
>    NSTimer *_timer;
>    NSAlert *_timeoutAlert;
>    NSUInteger _secondsRemaining;
> 
> 
> Season to taste…_______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers



More information about the Unison-hackers mailing list