Below are 17 coding issues discovered by the developers during the Hackathon. Some are serious - some are recommendations only ... some are relatively easy fixes - some will require more work.
Please have your team review these and let us know how you want to proceed.
Loading of custom cells
Currently the app uses
cell = [[[NSBundle mainBundle] loadNibNamed:@"AirPortListCustomCell" owner:self options:nil] objectAtIndex:0];
Recommend using the following options instead
option 1: Use storyboard and design the custom cell inline
option 2: - (void)registerNib:(UINib )nib forCellReuseIdentifier:(NSString )identifier
it's available since iOS 5
Replace networking framework.
ASIHTTPRequest is not supported since 2011. Use AFNetworking framework's AFHTTPSessionManager instead.
No need for SBJSON
Apple has a built in JSON serializer called NSJSONSerialization. It's available since iOS 5.
As an alternative you could use Github's Mantle framework to convert between Model objects and JSON.
Use CocoaPods to add external frameworks. It's easier to organize and maintain them.
Instead of using multiple view controllers in a single XIB file (OffersViewController), use - (void)addChildViewController:(UIViewController *)childController and
load them on-demand.
Code/resources could be organization into physical folders. It's a good practice to create folders to back XCode groups. Always use relative path instead of absolute.
Repos should always contain .gitignore files
Lot of commented out code. That's either a leftover from some other code or they are not sure if they need that code later. We need to remove them.
Excessive use of NSLog. Use DLog and ALog instead.
Over 300 warnings. Warnings should be handled as errors. Lot of unimplemented protocols and use of deprecated enums/methods.
Lack of keywords before all arguments.
-(void)sharedSocialServiceStatus:(NSString )dealId:(NSString )userId:(NSString )airportID:(NSString )sharedString
should be
-(void)sharedSocialServiceStatus:(NSString )dealId userId:(NSString )userId airPortID:(NSString )airportID sharedString:(NSString )sharedString
Too much code in the application delegate. Core location, beacon, keychain manager etc. They do not belong there. Move it to a separate classes.
properties are auto synthesized, so @synthesize is no longer needed.
IBOutlets should be declared as weak.
Use Objective-C literals
self.categoryImagesArray=[[NSMutableArray alloc] initWithObjects:@"all_icon",@"drink_icon",@"dutyfree_icon",@"family_icon",@"food_icon",@"newsstand_icon",@"services_icon",@"shopping_icon",@"setting_icon",@"favourites_icon",nil]
can be written as
self.categoryImagesArray= @["all_icon",@"drink_icon",@"dutyfree_icon",@"family_icon",@"food_icon",@"newsstand_icon",@"services_icon",@"shopping_icon",@"setting_icon",@"favourites_icon"]
airportsList.Longitude=[mainDict objectForKey:@"Longitude"];
is equivalent with
airportsList.Longitude=mainDict[@"Longitude"];
Use of separate xib files for 3.5 and 4 inches display. It's not wrong per se, but apple will release new display sizes soon, so I would suggest using autolayout instead.
Lack of localization. It's gonna be important once you go international
Use NSLocalizedString
Below are 17 coding issues discovered by the developers during the Hackathon. Some are serious - some are recommendations only ... some are relatively easy fixes - some will require more work.
Please have your team review these and let us know how you want to proceed.
cell = [[[NSBundle mainBundle] loadNibNamed:@"AirPortListCustomCell" owner:self options:nil] objectAtIndex:0];
Recommend using the following options instead option 1: Use storyboard and design the custom cell inline option 2: - (void)registerNib:(UINib )nib forCellReuseIdentifier:(NSString )identifier it's available since iOS 5
should be -(void)sharedSocialServiceStatus:(NSString )dealId userId:(NSString )userId airPortID:(NSString )airportID sharedString:(NSString )sharedString
See https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-BCIGIJJF
can be written as self.categoryImagesArray= @["all_icon",@"drink_icon",@"dutyfree_icon",@"family_icon",@"food_icon",@"newsstand_icon",@"services_icon",@"shopping_icon",@"setting_icon",@"favourites_icon"]
airportsList.Longitude=[mainDict objectForKey:@"Longitude"]; is equivalent with airportsList.Longitude=mainDict[@"Longitude"];