SlideShare a Scribd company logo
1 of 29
Топ-10 ошибок
  при разработке iPhone-приложения


                 Top 10
iPhone Application Development Mistakes


                Alexander Kaverin
    iPhone developer at Ciklum for iAgentur.ch
Section A
User Interface
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
Standard controls offered by iPhone SDK
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
2. Overusing Interface Builder
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
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
Section B
Application Design
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.
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
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;
}
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 processes

•   Network data transfer

    •   Operations over Wi-Fi consume less power than
        operations over mobile networks

•   Inefficient usage of CoreLocation
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
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

•   Following retain/release paradigm and maintaining object
    ownership rules is mandatory

•   Use Instruments to debug memory issues effectively
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];
  ...                            ...
}                              }
9. Retain cycle
myView                 myDelegate

    1                        1
9. Retain cycle
myView                            myDelegate

    1                                   1
     self.delegate = myDelegate

     [_delegate retain]
                                        2
9. Retain cycle
myView                                      myDelegate

    1                                              1
     self.delegate = myDelegate

     [_delegate retain]
                                                   2

     myDelegate.view = self
                                  [_view retain]
    2
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
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];
  ...                            ...
}                              }
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];
}                                ...
                               }
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
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
Q&A

More Related Content

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

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

  • 1. Топ-10 ошибок при разработке iPhone-приложения Top 10 iPhone Application Development Mistakes Alexander Kaverin iPhone developer at Ciklum for iAgentur.ch
  • 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
  • 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
  • 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
  • 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
  • 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