Your SlideShare is downloading. ×
  • Like
Топ-10 ошибок при разработке iPhone-приложения
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Топ-10 ошибок при разработке iPhone-приложения

  • 898 views
Published

 

Published in Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
898
On SlideShare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
10
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Топ-10 ошибок при разработке iPhone-приложения Top 10 iPhone Application Development Mistakes Alexander Kaverin iPhone developer at Ciklum for iAgentur.ch
  • 2. Section A User Interface
  • 3. 1. Not following HIG • HIG stands for iPhone Human Interface Guidelines http://developer.apple.com/iphone/library/documentation/UserExperience/ Conceptual/MobileHIG/ • Providing a consistent visual experience has always been important for the Mac - so it is for iPhone
  • 4. Standard controls offered by iPhone SDK
  • 5. 2. Overusing Interface Builder • Interface Builder, despite its extensive functionality, is not a tool to create complete visual design • IB may not contain some essential settings • IB is good for static interface objects. For dynamic objects coding is better • Unarchiving a .xib file is more resource-consuming than setting properties in code
  • 6. 2. Overusing Interface Builder
  • 7. 3. Slow responsiveness • Bad practice: • preloading too much data in advance • complex view hierarchy • filling invisible areas of views • displaying large lists when they are not requested • Memory usage also affects UI responsiveness
  • 8. 3. Slow responsiveness • Good practice: • loading larger portions of data only on user’s demand • you may even show an empty screen for a while before the data is loaded • move non-UI operations to separate threads • Remember: the user always expects to see (almost) immediate reaction to his actions
  • 9. Section B Application Design
  • 10. 4. Relying on a fast network performance • iPhone devices can operate in Wi-Fi, 3G, EDGE and GPRS networks • Supporting only Wi-Fi network may lead to malfunctioning and even to AppStore rejection.
  • 11. 4. Relying on a fast network performance If an Application requires or will have access to the cellular network, then additionally such Application: • Must comply with Apple's best practices and other guidelines on how Applications should access and use the cellular network; • Must not in Apple's reasonable judgment excessively use or unduly burden network capacity or bandwidth; • May not have Voice over Internet Protocol (VoIP) functionality using the cellular network. Paragraph 3.3.19 of the iPhone SDK agreement
  • 12. 4. Relying on a fast network performance • Solutions: • Display slow connection alert. Use SCNetworkReachabilityGetFlags - (BOOL)isWifiAvailable { BOOL wifi = NO; const char *host_name = "google.com"; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName( NULL, host_name); SCNetworkReachabilityFlags flags; SCNetworkReachabilityGetFlags(reachability, &flags); CFRelease(reachability); if (flags == 2) { wifi = YES; } return wifi; }
  • 13. 4. Relying on a fast network performance • Solutions: • UIRequiresPersistentWiFi key in Info.plist
  • 14. 5. Battery life • Battery life and memory / CPU usage are the Apple’s official reasons to disallow background processes • Network data transfer • Operations over Wi-Fi consume less power than operations over mobile networks • Inefficient usage of CoreLocation
  • 15. 6. Resigning active state of the application • The application becomes inactive: • when accepting a call • when the iPhone screen goes to sleep • Resetting application in this situation is not the best practice
  • 16. Section C Objective-C and Cocoa
  • 17. 7. Breaking the MVC pattern Model - View - Controller
  • 18. 8. Bad memory management
  • 19. 8. Bad memory management • iPhone Objective-C runtime, unlike Mac OS (10.5 +) does not support garbage collection • Following retain/release paradigm and maintaining object ownership rules is mandatory • Use Instruments to debug memory issues effectively
  • 20. 9. Retain cycle myView myDelegate MyViewClass : UIView { MyDelegateClass : NSObject { ... ... id _delegate; UIView *_view; } } @property (retain) delegate; @property (retain) view; ... ... - (void) dealloc { - (void) dealloc { [_delegate release]; [_view release]; ... ... } }
  • 21. 9. Retain cycle myView myDelegate 1 1
  • 22. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate [_delegate retain] 2
  • 23. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate [_delegate retain] 2 myDelegate.view = self [_view retain] 2
  • 24. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate [_delegate retain] 2 myDelegate.view = self [_view retain] 2 [myDelegate release] [myView release] 1 1
  • 25. 9. Retain cycle myView myDelegate MyViewClass : UIView { MyDelegateClass : NSObject { ... ... id _delegate; UIView *_view; } } @property (retain) delegate; @property (retain) view; ... ... - (void) dealloc { - (void) dealloc { [_delegate release]; [_view release]; ... ... } }
  • 26. 9. Retain cycle myView myDelegate MyViewClass : UIView { MyDelegateClass : NSObject { ... ... id _delegate; UIView *_view; } } @property (assign) delegate; @property (retain) view; ... ... - (void) dealloc { - (void) dealloc { ... [_view release]; } ... }
  • 27. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate myDelegate.view = self [_view retain] 2 [myDelegate release] [_view release] 0 1 [myView release] 0
  • 28. 10. Usage of private API • Not recommended by Apple • May become a reason of rejection from the AppStore • Private API may change at any OS / SDK release without notice
  • 29. Q&A