2,623 questions
0
votes
0
answers
28
views
How to correctly call an iOS completionHandler block from Delphi without crashing?
I’m trying to implement this iOS delegate method in Delphi:
- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task willBeginDelayedRequest:(NSURLRequest *)request ...
1
vote
2
answers
265
views
convert gcc forward-declared nested function to clang blocks
I know this is impossible because I've spent hours on it and also read these below but I am determined to approximate a clang block forward definition even if it takes linker tricks or inline assembly:...
0
votes
1
answer
30
views
how to check if scrollView grinds to a halt when tabbar is clicked?
A viewcontroller is the child of tabbarcontroller, it has a tableview, when the tableview grinds to a halt, one of three methods is executed.
- (void)scrollViewDidEndDragging:(UIScrollView *)...
1
vote
1
answer
125
views
How to share a block between MRC and ARC code?
I have a piece of ARC code written in Objective-C that is creating a block and will want to provide it to some Objective-C MRC code as a callback, to be called when an operation finishes. What is the ...
3
votes
0
answers
3k
views
What is iOS's block_destroy_helper function?
I noticed a function named block_destroy_helper in this crash log from my iOS app. I want to know more what is this function, but I can't find any useful information. I just want to know the ...
4
votes
1
answer
1k
views
Calling block from Objective C collection in Swift
I have a Swift object that takes a dictionary of blocks (keyed by Strings), stores it and runs block under given key later at some point depending on external circumstances (think different behaviours ...
0
votes
1
answer
824
views
Pass Objective-C block or method as C-function pointer
I'm using https://github.com/nodejs/http-parser, the callbacks it uses are like this
struct http_parser_settings {
http_cb on_message_begin;
http_data_cb on_url;
http_data_cb on_status;
...
2
votes
2
answers
152
views
Will weak pointer in a block become dangling when I refer it with stong pointer in OC?
as the question described, will the wSelf in block become dangling?
1 void bindDefaultCallbacks {
2 __weak typeof(self) wSelf = self;
2 [sessionManager setDataTaskDidReceiveDataBlock:^(...
2
votes
1
answer
318
views
A memory leak when capturing callback function from block of setTerminationHandler of NSTask
I created a simple code and found there is a memory leak:
#import <Foundation/Foundation.h>
#include <functional>
void testLeaks(const std::function <void (int)>& inCallback) {
...
0
votes
1
answer
521
views
Block with completion and arguments
I am new to blocks. I am trying to analyze how the following code works.
As i understand this specific method has a block and returns a
NSURLSessionDataTask
. getTotalFollowersFrom is the name of ...
0
votes
1
answer
207
views
How to remove copy and save to files option in UIPrintInteractionController
In the print preview screen, if no printer is connected, click on the print button, a popover is displayed in iOS 15 containing the Copy and Save to files option.
I want to remove this popover, As ...
0
votes
0
answers
129
views
Alternative to runUntilDate for waiting until animation is complete
We have an application that has some code similar to the following:
[UIView animationWithDuration: 0.7f animations {
// Some animations
}];
[NSRunLoop currentRunLoop] runUntilDate: [NSDate ...
0
votes
0
answers
285
views
why I m getting clang error when i run on Xcode 12?
I am facing clang error when I am trying to run the source in Xcode 12.5 But it is working fine in 11.4
In file included from :1: PrefixHeader.pch:15:2: fatal error: malformed or corrupted AST file: '...
0
votes
0
answers
50
views
Workaround on nested async completion blocks from network calls? Without using PromiseKit
Basically I have an existing API manager that is blocking me from going forward. This existing manager is something I should not mess with right now.
This is the gist of my problem. I mean, I can go ...
1
vote
1
answer
195
views
Objective-C. Block that returns a string and printing it out
Just got my first job as a Junior iOS. I am going to work with Objective-C a lot which I have little familiarity with, therefore I hope you can forgive me these simple questions.
I had this bit of ...
1
vote
1
answer
841
views
UIAlertAction handler block and main thread
The scenario: the user is presented with a UIAlertController that has a button, with a handler block that updates the UI to indicate the button press. The code in the handler block is wrapped in a ...
2
votes
1
answer
162
views
EXC_BAD_ACCESS from setting pass-by-writeback error within enumerateObjectsUsingBlock
The following code causes an EXC_BAD_ACCESS upon attempting to set *error.
- (void)triggerEXC_BAD_ACCESS
{
NSError *error = nil;
[self doSetErrorInBlock:&error];
}
- (void)...
1
vote
1
answer
76
views
How do you hold a reference to parameter in a block?
I am passing a parameter to a function, and I need to hold its reference in a block. The block will be executed at a later time. If I dont hold this reference, I get invalid memory access crash when ...
1
vote
2
answers
365
views
Can NSBlockOperation cancel itself while executing, thus canceling dependent NSOperations?
I have a chain of many NSBlockOperations with dependencies. If one operation early in the chain fails - I want the other operations to not run. According to docs, this should be easy to do from the ...
3
votes
1
answer
341
views
C blocks extension (libBlocksRuntime) - use custom memory allocator (Boehm GC) for Block_copy()
I am writing a C program that uses Apple's Blocks extension to provide lexical closures. I am also using the Boehm garbage collector. What I would like is for Block_copy() to use GC_MALLOC when ...
2
votes
2
answers
1k
views
Xcode12 compile error against Cocos3D: Incompatible block pointer types
"Xcode 12.0 (12A7209)" shows compile error against Cocos3D library (written in Objective-C) in the following code:
(The past versions of Xcode ((ie ver.11, 10), including ver 11.7(11801a)) ...
2
votes
1
answer
76
views
Objective C block syntax - Xcode autocomplete is not working
Some OBJECTIVE-C blocksyntax help, please.
This is my call site (AppDelegate) - autocompleted by XCode
Objective-C
[SwiftClass passValue: response completion:^(NSDictionary<NSString *,NSString *&...
0
votes
1
answer
62
views
Modal NSSavePanel disappears after animating in when begun from a completion block
G'day!
Note: Minimal example linked below. I'll refrain from longish code excerpts and rather explain the problem concisely.
I am in the process of updating an old (but small) Cocoa application to ...
0
votes
1
answer
47
views
Second animateWithDuration call disables animation
I have what I thought was a very simple case of animation. There is a view that sits at 0 alpha unless it becomes 1 until a future animation with one type of event, or becomes 1 for a few seconds with ...
0
votes
1
answer
27
views
Doing 1+ async API calls before doing final async API
I have a iOS app where at a given moment I have do 1+ async api calls which needs to be completed before I can send the final async call to my server. What is the best way to do it? e.g.
Start
async ...