Support for Objective-C Blocks
See original GitHub issueHi, I stumbled upon a dead-end working with MCNearbyServiceAdvertiserDelegate
. One of its required delegate methods involves an NSStackBlock
, which is not callable. Is there a work around?
@protocol('MCNearbyServiceAdvertiserDelegate')
def advertiser_didReceiveInvitationFromPeer_withContext_invitationHandler_(self,
advertiser, peerId, context, invitationHandler):
invitationHandler(ObjcBool(True), self.session)
that code results in:
Exception TypeError: "'__NSStackBlock__' object is not callable" in 'pyobjus.pyobjus.protocol_forwardInvocation' ignored
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Working with Blocks - Apple Developer
Describes elements of best practice when writing code with Objective-C using ARC.
Read more >Blocks and Closures in Objective-C | by Amy Joscelyn - Medium
Blocks are hard. Conceptually difficult to understand, blocks are nonetheless integral to many facets of Objective-C and other languages.
Read more >Objective-C Blocks - Tutorialspoint
Objective-C Blocks, An Objective-C class defines an object that combines data with related behavior. Sometimes, it makes sense just to represent a single ......
Read more >Introduction to Objective-C Blocks - AppCoda
This programming tutorial gives you an introduction of Objective-C blocks that was introduced in iOS 4.0 SDK. Blocks is a feature similar to ......
Read more >Objective-C Blocks - raywenderlich.com - YouTube
Blocks are a language-level feature added to C, Objective - C and C++, which allow you ... such as requesting information from a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A quick follow up to this. I’ve found that while its most convenient from a code writing standpoint to just leverage pyobjus to use objc directly from python there are alot of time this breaks.
MY SUGGESTION: Make a .dylib file in objc. Import this using pyobjus then you can call from some custom functions from pythohn, and get the right data you need. This has saved me alot of time and always works, but its a bit more work.
Good Luck!
If anyone has some tips or sample code I could follow, I would greatly appreciate it. I am trying to do access HealthKit data like @SoundsSerious however I’m 2 years late to the party. I am working on making a dylib file now.