Questions tagged [completion-block]

54 questions
0
votes
2 answers

Objective-C sequentially Executing Two Completion Blocks

I'm currently working on enabling a DJI product to execute waypoint missions autonomously, adapting from a DJI tutorial (https://developer.dji.com/mobile-sdk/documentation/ios-tutorials/GSDemo.html). So I'm trying to integrating all the processes…
0
votes
2 answers

how to represent nil Error Swift completion block

Hi I have a web service worker object in swift that passes a completion block to the caller view controller. The code is as follows: func getFlightData(for airportCode: String, minutesBehind:String, minutesAhead:String, completion: (([Flight],…
Ackman
  • 1,562
  • 6
  • 31
  • 54
0
votes
1 answer

Objective C completion block doesn't get called

I am trying to call a completion block in a unit test but it never reaches. Here is the code: [vc configureRecorder:^{ NSLog(@"Completion..."); }]; This is the method: -(void)configureRecorder:(void(^)(void))callback { NSLog(@"Method"); }
Niall Kiddle
  • 1,477
  • 1
  • 16
  • 35
0
votes
1 answer

IOS/Objective-C: Retrieve NSArray from completion block

I am trying to retrieve an array of EKReminders from a completion block of a method. The method returns the array I desire. However, I can't find a good way to obtain it back on the main thread at known time such that that I know the block has…
user6631314
  • 1,751
  • 1
  • 13
  • 44
0
votes
1 answer

Nested completionBlock is not getting called objc

This is my nested block, please take have a look : - (void)getVideoList:(NSDictionary*)videoData completionBlock:(void (^)(NSMutableArray *)) completionBlock { NSArray *videos = (NSArray*)[videoData objectForKey:@"items"]; …
0
votes
1 answer

Create a completion block that returns nothing but executes another function when completed?

I'm trying to create a completion block that can execute another function after its completed, in this case it's a tableview reload. I get the error : 'async' produces '()', not the expected contextual result type 'Bool' This is the function: …
SwiftyJD
  • 5,257
  • 7
  • 41
  • 92
0
votes
2 answers

how to execute completion block from another method in objective-c?

Is it impossible to get completion block success then data received from another method? @property myCompletion; // I have first call listeners, i can't add this in to "createOrderWithsuccess" -(void)listeners { [[SocketIOManager…
0
votes
1 answer

CLLocationManager auth request not made when invoked in block

Having some issues with my auth request method shown below: func requestAuthorisation() { if CLLocationManager.authorizationStatus() == .NotDetermined { let locationPermissionRequest = UIAlertController.init(title: "Location…
Jacob King
  • 6,025
  • 4
  • 27
  • 45
0
votes
1 answer

Dissmiss completion block doesn't work. Swift

I have PhotoBrowser (it inherits from UIViewController) as a presentedViewController. I present it from UITableViewController. The PhotoBrowser presents actionMainController (it inherits from UIAlertController) when I tapped on button. I want to…
Alexander Khitev
  • 6,417
  • 13
  • 59
  • 115
0
votes
1 answer

Swift 3.0 cannot convert value of type (_, _)->() to Expected argument type 'ObjectsOrErrorBlock'

I've used typedef in objective-c to define a completion block like so: typedef void(^ObjectsOrErrorBlock) (NSArray* objects, NSError* error); I then have a Swift 3.0 function that takes the ObjectsOrErrorBlock as a parameter. When I try to use the…
Minimi
  • 921
  • 10
  • 29
0
votes
1 answer

Doing an action after UIView beginAnimations is finish

I want to do an action when the UIView animation is finish. if (flipStateHav1 == 1 && btnFrontHav1.tag == 1) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.8]; [UIView…
user3266053
  • 175
  • 1
  • 1
  • 10
0
votes
2 answers

Completion blocks return nothing

import UIKit class ViewController: UIViewController { override func viewDidLoad() { isSuccess(true, success: { (name) -> String in return "My name is \(name)" }) super.viewDidLoad() // Do any…
ilovecomputer
  • 4,238
  • 1
  • 20
  • 33
0
votes
1 answer

Objective-C completion block for animation within for loop (pause loop processing)

I have a method to fade in, then fade out a button label (shown below): -(void)fade:(NSString *)text { NSLog(@"Starting Fade In for symbol %@",text); [self.symbolButton setAlpha:0.0f]; [self.symbolButton setTitle:text…
user1676300
  • 135
  • 7
0
votes
2 answers

Swift Completion Block

I want to achieve the following : In classB, to reload my database after adding 1 object. reloadDatabase() is called within the completionBlock. In classB, reloadDatabase() will call getObjects() in classA to get the most updated list of database…
perwyl
  • 323
  • 3
  • 14
0
votes
1 answer

Is There A Neat Way to Attach a Completion Block to an NSURLSessionDataDelegate Callback in Swift?

OK, here's the deal: I have a URL call I'm making in a Swift app, sort of like so: /*! @brief Tests a given Root Server URL for validity @discussion What we do here, is append "/client_interface/serverInfo.xml" to the given…
Chris Marshall
  • 4,910
  • 8
  • 47
  • 72