Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 28, 2013, 06:30 PM   #1
ruchi830
macrumors newbie
 
Join Date: Jan 2013
Pyobjc Sparkle setDelegate_

I am using Sparkle for my app's update launcher. I need to setDelegate for Sparkle's willInstallUpdate.

The correct method is:
Code:
// Sent immediately before installing the specified update.
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
In python, I do:
Code:
SUUpdater.sharedUpdater().setDelegate_(updater_willInstallUpdate_)
And I have this global function:
Code:
def updater_willInstallUpdate_():
    NSLog("UPDATER WILL INSTALL UPDATE")
    # do stuff
    return
This does not work. In PyObjc documentation, it says:
"Another gotcha is that obj.setDelegate_() often does not retain the delegate, so a reference should be maintained elsewhere."
I'm not sure how to apply this to my code. I also tried:
Code:
delegate = updater_willInstallUpdate_ 
SUUpdater.sharedUpdater().setDelegate_(delegate)
but this did not work either.
Can someone help me out?

When I try to check for updates, I get:

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000

VM Regions Near 0:
-->
__TEXT 000000010902c000-0000000109031000 [ 20K] r-x/rwx SM=COW /Applications/MezeoFile.app/Contents/MacOS/MezeoFile

Application Specific Information:
objc_msgSend() selector name: respondsToSelector:
objc[47765]: garbage collection is OFF
Performing @selector(updates from sender NSMenuItem 0x7fc7b85a1320

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff9749afdf objc_msgSend_fixup + 95
1 org.andymatuschak.Sparkle 0x000000010b144d1b 0x10b142000 + 11547
2 org.andymatuschak.Sparkle 0x000000010b144531 0x10b142000 + 9521
3 _objc.so 0x00000001096ca73c ffi_call_unix64 + 76
4 _objc.so 0x00000001096cb44a ffi_call + 714
5 _objc.so 0x00000001096db6d0 PyObjCFFI_Caller + 2272
6 _objc.so 0x00000001096fc9de 0x1096c9000 + 211422
7 org.python.python 0x0000000109391c31 PyObject_Call + 97
8 org.python.python 0x000000010942a305 PyEval_EvalFrameEx + 18725

Last edited by SandboxGeneral; Jan 28, 2013 at 07:20 PM. Reason: Added code tags
ruchi830 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump


All times are GMT -5. The time now is 05:39 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC