Tag: objective c

Sending NSMutableArray OR NSDictionary to php to mysql

In my application, i made an activity to get input numbers from the user, the number of textfields for input data is different each time, it’s a tableView and each cell has a textfield, i managed to store all the numbers in a NSMutableArray, and I’ve been looking into how to pass it to my […]

Forcing the order of execution using dispatch_sync

My library exposes 2 APIs as follows to: -(void) createFile{ dispatch_sync(queueSerial, ^{ //B1 [fileObj createFileInfo:file completion:^(NSError *error){ //execute completion block C1 }]; }); } -(void) readFile:(NSData*)timeStamp{ dispatch_async(queueSerial, ^{ //B2 [fileObj readFileInfo:fileName completion:^(NSError *error) { dispatch_async(queueSerial2, ^{ //execute completion block C2 }); }] }); } Both readFile and createFile are asynchronous methods. I usually recommend to […]

method returns before completionhandler

I am developing a networkUtil for my project, I need a method that gets a url and returns the JSON received from that url using NSURLSessionDataTask to get a JSON from server. the method is the following: + (NSDictionary*) getJsonDataFromURL:(NSString *)urlString{ __block NSDictionary* jsonResponse; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *dataTask = [session dataTaskWithURL:[NSURL URLWithString:urlString] […]

How do I set the size of Google Maps app within my ViewController?

I started a brand new Single View project with just Google Maps SDK being integrated in it. Right now it spans over all the screen (full-size), which I believe is the default setting. I want to reduce it so it doesn’t take up space on the top bar and I also want to leave space […]

How to insert array values to draw polygon based on long/lat values – Google Maps iOS?

I am trying the GMSPolygon *polygon = [GMSPolygon polygonWithPath:rect]; method to draw a polygon of the tapped coordinates by the user. Here’s how I store the clicked coordinates: // array made of clicked coordinates NSMutableArray *latitudeTappedCoordinates = [NSMutableArray array]; NSMutableArray *longitudeTappedCoordinates = [NSMutableArray array]; NSUInteger numberOfLongitudeCoordinates = [longitudeTappedCoordinates count]; NSUInteger numberOfLatitudeCoordinates = [latitudeTappedCoordinates count]; for […]

With 3D touch peek and pop, how do you detect the user panning during a peek (like Facebook)?

In the Facebook app, if you “peek” a photo that is part of an album, you can slide your finger horizontally to go to other photos. How is this accomplished within the API? All I see exposed is offering a view controller and committing that view controller upon pop.

Request failed: bad request (400) in “AFMultipartFormData”

I am working with afnetworking with objective c. My parameter type is “formData”. So I am using “AFMultipartFormData” Here is my code NSLog(@”enter in requestPostFormData”); AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@”application/json”]; [manager.requestSerializer setValue:@”application/x-www-form-urlencoded” forHTTPHeaderField:@”Content-Type”]; [manager.requestSerializer setValue:strAuthorization forHTTPHeaderField:@”Authorization”]; return [manager POST:baseURL parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData){ //passing […]

how to make authorization to server into iOS app without user?

I’m new in iOS programming. I made iOS app with connection to MSSQL. It works fine when online dialog authorization to server deactivated Accordingly when we activate authorization my app does not work. Server authorization picture. How can I specify authorization data in my app? How can I fill login and pass background in app? […]

NSBundleResourceRequest bundlePath

[UPDATE AT THE END OF THE QUESTION] I use to play some audio files in my app. I used to store the files in the app, but then I moved to On Demand Resourcesand NSBundleResourceRequest. I have an IBAction to play a random file, and since I moved to ODR, it is not working. The […]

how to get all installed applications with Objective C in OSX

I need to get all installed application on the OSX using objective c I googled and found someone suggesting to do this with terminal command: I am running this command on terminal “system_profiler SPApplicationsDataType -xml” to find all applications but I am not able to retrieve the terminal data from code behind. please provide a […]