The NSBlockOperation class is a concrete subclass of NSOperation that manages the concurrent execution of one or more blocks. You can use this object to execute several blocks at once without having to create separate operation objects for each.
Questions tagged [nsblockoperation]
42 questions
0
votes
1 answer
iOS Swift: NSBlockOperation behaves differently on iPhone simulator 6s and 5s
I found it strange to see the different behaviors for my NSBlockOperation in updating the UI in my app.
For each of the UIButtons (e.g. Thumb-up, Thumb-down, Like, etc), I have them linked to their action method which is similar to the one below…

TonyW
- 18,375
- 42
- 110
- 183
0
votes
1 answer
Why dispatch_sync on main thread cause deadlock but NSBlockOperation doesn't?
As the title, dispatch_sync() on main queue and main thread will cause deadlock, like that:
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"%@", [NSThread currentThread]);
});
But NSBlockOperation will not cause deadlock:
NSBlockOperation…

BourneWeng
- 21
- 6
0
votes
1 answer
NSOperationQueue with operation block not working as desired in SWIFT
I have to check series of operations sequentially. but in case of any operation failed i need to call other operation before executing listed operation in queue.
for example:
priority 1 : Fetch all companies lookups
priority 2 : Fetch all…

Ruchi
- 5,032
- 13
- 59
- 84
0
votes
1 answer
Combine AFHTTPRequestOperation and NSBlockOperation (iOS)?
I want to perform 2 requests and send a notification at the end. My code to check a sequence of the operations:
AFHTTPRequestOperation *operation1 = ...;
AFHTTPRequestOperation *operation2 = ...;
[operation1…

Gargo
- 1,135
- 1
- 10
- 21
0
votes
1 answer
Not understanding NSOperationQueue sequence
I have a model class called DataFetcher that fetches data via a web service, then persists the data to a Core Data datastore, then updates a ViewController via delegate methods. Here is the normal sequence (which works properly) without using…

Pheepster
- 6,045
- 6
- 41
- 75
0
votes
1 answer
When does the NSBlock get freed?
In a view controller I have a property of NSBlock of copy type as follow
@interface myViewController
@property(nonatomic, copy) MyBlock *block;
@end
@implementation myViewController
@end
When my application pop from myViewController then my block…

jailani
- 2,260
- 2
- 21
- 45
0
votes
2 answers
NSBlockOperation and objects in the block
Here is the simple code:
// let's assume that I have to allocate this variable with alloc/init
NSString *someString = [[NSString alloc] initWithFormat:"%@", @"someString"];
NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
…

user3776727
- 13
- 2
0
votes
3 answers
Using NSBlockOperations properly so everything executes in background
I'm trying to make network requests on a background thread and I've decided to use NSBlockOperations. I'm using ADNKit to handle my fetch requests. Here's the code:
- (void)reloadPosts
{
…

Shawn Throop
- 1,281
- 1
- 13
- 28
0
votes
1 answer
Setting a strong NSBlockOperation on a UIWebView. Is this a bad idea?
I am debugging an interesting issue with my app.
The app is targeted at iOS6.1 and it is using ARC.
Here is some background since it is too large to copy paste into SO.
There is a Dashboard class that has a child view controller. This child view…

hippeelee
- 1,788
- 1
- 10
- 21
0
votes
0 answers
Error in downloading an audio file form server synchronously
I am using a NSBlockOperation in which i am trying to downlaod an audio file from server & storing it in documents directory.
NSBlockOperation *audioOperation = [NSBlockOperation blockOperationWithBlock:^{
//Perform doanload
NSString…

Mahesh Paymal
- 37
- 8
0
votes
1 answer
Strange Core-Data behaviour
I perform some work using an NSBlockOperation and inside this block the persistent store loses its persistent stores.
the following code:
- (void) eraseCoreData_ManagedObjectsInArray:(NSArray *) arrayOfManagedObjectsToDelete…

some_id
- 29,466
- 62
- 182
- 304
0
votes
1 answer
NSBlockoperation is not getting cancelled
I've a uitableview which shows images in each cell, which are downloaded online.
To make this call async, I use NSBlockoperation. I prefer to use this, because i used GCD before but you cannot cancel GCD. The reason is that if I leave the view, the…

Prastow
- 178
- 1
- 19