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


                 Top 10
iPhone Application Development Mistakes


     ...
Section A
User Interface
1. Not following HIG



•   HIG stands for iPhone Human Interface Guidelines
    http://developer.apple.com/iphone/library...
Standard controls offered by iPhone SDK
2. Overusing Interface Builder


•   Interface Builder, despite its extensive
    functionality, is not a tool to create c...
2. Overusing Interface Builder
3. Slow responsiveness


•   Bad practice:

    •   preloading too much data in advance

    •   complex view hierarchy

 ...
3. Slow responsiveness


•   Good practice:

    •   loading larger portions of data only on user’s demand

    •   you ma...
Section B
Application Design
4. Relying on a fast network
              performance


•   iPhone devices can operate in Wi-Fi, 3G, EDGE and GPRS
    ne...
4. Relying on a fast network
               performance

If an Application requires or will have access to the cellular ne...
4. Relying on a fast network
                performance
•    Solutions:

    •   Display slow connection alert.
        U...
4. Relying on a fast network
                performance
•   Solutions:

    •   UIRequiresPersistentWiFi key in Info.plist
5. Battery life


•   Battery life and memory / CPU usage are the Apple’s
    official reasons to disallow background proce...
6. Resigning active state of the
              application

•   The application becomes inactive:

    •   when accepting ...
Section C
Objective-C and Cocoa
7. Breaking the MVC pattern




      Model - View - Controller
8. Bad memory management
8. Bad memory management



•   iPhone Objective-C runtime, unlike Mac OS (10.5 +) does
    not support garbage collection...
9. Retain cycle
         myView                       myDelegate


MyViewClass : UIView {         MyDelegateClass : NSObje...
9. Retain cycle
myView                 myDelegate

    1                        1
9. Retain cycle
myView                            myDelegate

    1                                   1
     self.delegate...
9. Retain cycle
myView                                      myDelegate

    1                                             ...
9. Retain cycle
                   myView                                         myDelegate

                       1    ...
9. Retain cycle
         myView                       myDelegate


MyViewClass : UIView {         MyDelegateClass : NSObje...
9. Retain cycle
         myView                       myDelegate


MyViewClass : UIView {         MyDelegateClass : NSObje...
9. Retain cycle
                   myView                                          myDelegate

                       1   ...
10. Usage of private API



•   Not recommended by Apple

    •   May become a reason of rejection from the AppStore

    ...
Q&A
Upcoming SlideShare
Loading in …5
×

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

1,146 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,146
On SlideShare
0
From Embeds
0
Number of Embeds
465
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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

  1. 1. Топ-10 ошибок при разработке iPhone-приложения Top 10 iPhone Application Development Mistakes Alexander Kaverin iPhone developer at Ciklum for iAgentur.ch
  2. 2. Section A User Interface
  3. 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. 4. Standard controls offered by iPhone SDK
  5. 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. 6. 2. Overusing Interface Builder
  7. 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. 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. 9. Section B Application Design
  10. 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. 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. 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. 13. 4. Relying on a fast network performance • Solutions: • UIRequiresPersistentWiFi key in Info.plist
  14. 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. 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. 16. Section C Objective-C and Cocoa
  17. 17. 7. Breaking the MVC pattern Model - View - Controller
  18. 18. 8. Bad memory management
  19. 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. 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. 21. 9. Retain cycle myView myDelegate 1 1
  22. 22. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate [_delegate retain] 2
  23. 23. 9. Retain cycle myView myDelegate 1 1 self.delegate = myDelegate [_delegate retain] 2 myDelegate.view = self [_view retain] 2
  24. 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. 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. 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. 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. 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. 29. Q&A

×