Category Archives: iOS

Locate real Watch Icons AssetS

It’s sometime confusing for new developers (or rather new Watch iOS developers) to find exactly where to set the Watch Icons. Well… it’s actually pretty simple.

It may be a bit unclear, because if you use a standard XCode template App, you may find two Assets.xcassets. The first would be under the WatchKit App and the second one under the Watch Kit Extension, usually where you insert your code logic.

Continue reading Locate real Watch Icons AssetS

iOS app submission and beta review process TIMES

  • UPDATE JULY 2019

TestFlight review times:

  • First upload build: takes 36h average.
  • Updates: take from 6h to 20h average for Build.

Weekends are off.

Submissions for mobile apps for iOS are subject to approval by Apple’s App Review team, as outlined in the SDK agreement, for basic reliability testing and other analysis, before being published on the App Store.

Applications may still be distributed ad hoc if they are rejected, by the author manually submitting a request to Apple to license the application to individual iPhones, although Apple may withdraw the ability for authors to do this at a later date.

An easy way to make MVC great again!

If you are a professional iOS or Android developer and you explicitly manifest your love for MVC as base architecture for your Apps, you are a leper and would be ostracized. 

Nowadays the MVC is frowned upon and not in the favor of altruistic developers.  

Viper, React, MVVM, those are good, MVC is bad and crappy… 

Truth or myth? 

Well, MVC is old indeed and certainty it got its flaws, most common of all, the feared “massive view controllers”. 

 But although the new aforementioned architectures bring to the table some solutions to MVC intrinsic issues, they do have some flaws as well, yeah “nobody is perfect”.

MVC is great, programmers are just too careless.

Continue reading An easy way to make MVC great again!

Buddybuild vs Xcode Server best Continuous Integration system. Current pick, security, risks, maintenance

I am currently setting up a Continuous Integration system for a complex iOS project. Ultimately, I came down to these two options, as I want to stay in Apple’s realm.

This is no easy fly question, I have read a lot about the matter, but the evil is on the details, I want to waive all the pros and cons before moving forward and start a complex implementation.

Continue reading Buddybuild vs Xcode Server best Continuous Integration system. Current pick, security, risks, maintenance

How to use Swift classes all across an Objective-C project

The most universal solution is to change SWIFT_OBJC_INTERFACE_HEADER_NAME (“Objective-C Generated Interface Header Name”) under Project’s, not Targets, Build Settings, to:

  • $(PROJECT_NAME)-Swift.h — one per project;
  • $(SWIFT_MODULE_NAME)-Swift.h — one per module (default value).

Then import the Project Header, example:

#import MyProjectName-Swift.h

Sending an HTTP POST request on iOS

The following code describes a simple example using POST method.(How one can pass data by POST method)

You can use the following code snippet, as described in this article:

Here, I describe how one can use of POST method.

1. Set post string with actual username and password.

NSString *post = [NSString stringWithFormat:@"Username=%@&Password=%@",@"username",@"password"]; 

2. Encode the post string using NSASCIIStringEncoding and also the post string you need to send in NSData format.

NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; 

You need to send the actual length of your data. Calculate the length of the post string.

NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]]; 

3. Create a Urlrequest with all the properties like HTTP method, http header field with length of the post string. Create URLRequest object and initialize it.

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; 

Set the Url for which your going to send the data to that request.

[request setURL:[NSURL URLWithString:@"http://www.abcde.com/xyz/login.aspx"]]; 

Now, set HTTP method (POST or GET). Write this lines as it is in your code.

[request setHTTPMethod:@"POST"]; 

Set HTTP header field with length of the post data.

[request setValue:postLength forHTTPHeaderField:@"Content-Length"]; 

Also set the Encoded value for HTTP header Field.

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

Set the HTTPBody of the urlrequest with postData.

[request setHTTPBody:postData];

4. Now, create URLConnection object. Initialize it with the URLRequest.

NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; 

It returns the initialized url connection and begins to load the data for the url request. You can check that whether you URL connection is done properly or not using just if/else statement as below.

if(conn) {
    NSLog(@"Connection Successful");
} else {
    NSLog(@"Connection could not be made");
}

5. To receive the data from the HTTP request , you can use the delegate methods provided by the URLConnection Class Reference. Delegate methods are as below.

// This method is used to receive the data which we get using post method.
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data

// This method receives the error report in case of connection is not made to server. 
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 

// This method is used to process the data after connection has made successfully.
- (void)connectionDidFinishLoading:(NSURLConnection *)connection

Also Refer This and This documentation for POST method.

And here is best example with source code of HTTPPost Method.