Top 10 reasons for iOS app rejection ?

Today apps are changing the world. The App Store has grown into an exciting and vibrant ecosystem for millions of developers. Whether you are a first-time developer or a large team of experienced programmers, we are excited that you are creating apps for the App Store and want to help you understand our guidelines so you can be confident your app will get through the review process quickly.

Here are top 10 reasons for app rejections from Apple.

16% Guideline 2.1 – Performance: App Completeness

14% More Information Needed

9% Guideline 4.1 – Design: Copycats

8% Guideline 2.3.7 – Performance: Accurate Metadata

4% Guideline 3.1.1 – Business: In-App Purchase

4% Guideline 2.3.3 – Performance: Accurate Metadata

3% Guideline 4.0 – Design: Spam

3% Guideline 4.0 – Design

3% Guideline 2.3.3 – Performance: Accurate Metadata

3% Did Not Comply with Program License Agreement

Failable Numeric Conversion Initializers | Swift 3.1

Swift 3.1 implements failable initializers for all numeric types like Int, Int8, Int16, Int32, UInt, UInt8, UInt16, UInt32, Float, Float80, Double. So which either completely successful without loss of information or simply returns nil.

This feature is very useful let’s see an example.

typealias JSONDictionary = [String: AnyObject]
class Employee  {
    let name: String
    let level: Double
    init?(json: JSONDictionary) {
       guard   let name = json["name"] as? String,
           let levelString = json["level"] as? String,
            let levelDouble = Double(levelString),
            let level = Int(exactly: levelDouble)  // 3.1 feature here
            else {
                return nil
        }
        self.name = name
        self.level = level
    }
}

func getEmployees(from data: Data) -> [Employee]?   {
    guard let json = try? JSONSerialization.jsonObject(with: data, options: .allowFragments),
        let jsonArray = json as? [JSONDictionary]   else {
            return nil
    }

    return jsonArray.flatMap(Employee.init)
}

let jsonString = "[{\"name\":\"John\", \"level\":\"7.2\"}]"
if let data = jsonString.data(using: .utf8) {
    let employees = getEmployees(from: data)
    print(employees ?? "its Nil")
} else {
    print("Data Nil")
}

nullable ? Swift – Objective C

Did you ever think? what will happen if your Objective C function will return nil to Swift function? because there is optional in Swift for managing nil values but in Objective C nothing.

//Objective-C code 
#import <Foundation/Foundation.h> 
@interface ObjCHello : NSObject 
-(NSArray * )getValue; 
@end  

//Swift code 
let objc = ObjCHello() 
print(objc.getValue()) 

//Objective-C 
#import <Foundation/Foundation.h> 
@interface ObjCHello : NSObject 
-(NSArray * _Nullable)getValue; 
@end

Now it will return value [Any]? and it won’t crash so just go for optional chaining.