cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse MacFadyen (JIRA)" <>
Subject [jira] [Updated] (CB-8863) Fix potential problems with blocks usage in core plugins
Date Fri, 04 Sep 2015 18:27:46 GMT


Jesse MacFadyen updated CB-8863:
    Component/s:     (was: iOS)

> Fix potential problems with blocks usage in core plugins
> --------------------------------------------------------
>                 Key: CB-8863
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugin Battery Status, Plugin Camera, Plugin Contacts, Plugin
Device Orientation, Plugin Dialogs, Plugin File, Plugin Geolocation, Plugin Globalization,
Plugin InAppBrowser, Plugin Media, Plugin Media Capture
>            Reporter: Shazron Abdullah
>            Assignee: Jesse MacFadyen
>              Labels: cordova-ios-4.0.x
> Audit the core plugins to check for proper blocks usage.
> Problems that I see can be summed up in this (fixed) code:
> 1. You need a weak reference to "self" in blocks to prevent retain cycle problems.
> Fix:
> 2. Anything that calls UIKit methods, which includes plugins that write JavaScript back
to the UIWebView (commandDelegate functions), must be called in the main thread.
> Fix:
(UPDATE: we actually already handle this in evalJS)
> 3. Avoid creating private variables like this in the first place -- I would create a
class extension which will effectively have "private" properties (nothing is truly private
in objc). This is to avoid this situation in the block where you have to cast the weak self
into a strong self (and check it's still around), just to access a private variable:
> Of course since we are modifying UIKit items here, rule 2 above also applies.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message