Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ruchi830

macrumors newbie
Original poster
Jan 10, 2013
4
0
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 a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.