Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

iOS9 fixes for Ionic

iOS9 introduces some breaking changes as well as a new security model for apps. If your app requires any http requests, the request will fail once they are recompiled locally.

For acces to any external URLs, simply add the follow to the platform/ios/<app-name>/Resources/<app-name>-Info.plist

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>

This will allow your app to have access to any URL. While this does work, you may want to limit access to only URLs you trust.

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSExceptionDomains</key>
      <dict>
        <key>www.ionicframework.com/</key>
        <dict>
          <key>NSIncludesSubdomains</key><true/>
          <key>NSExceptionRequiresForwardSecrecy</key><false/>
          <key>NSExceptionAllowsInsecureHTTPLoads</key><true/>
          <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key><true/>
        </dict>
      </dict>
    </dict>

This will only allow me to access the domain I have specified. For more info and to learn what each key does, take a look at Apple's ATS docs

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
.directive('ionRadioFix', function() {
return {
restrict: 'E',
replace: true,
require: '?ngModel',
transclude: true,
template:
'<label class="item item-radio">' +
'<input type="radio" name="radio-group">' +
'<div class="radio-content">' +
'<div class="item-content disable-pointer-events" ng-transclude></div>' +
'<i class="radio-icon disable-pointer-events icon ion-checkmark"></i>' +
'</div>' +
'</label>',
compile: function(element, attr) {
if (attr.icon) {
var iconElm = element.find('i');
iconElm.removeClass('ion-checkmark').addClass(attr.icon);
}
var input = element.find('input');
angular.forEach({
'name': attr.name,
'value': attr.value,
'disabled': attr.disabled,
'ng-value': attr.ngValue,
'ng-model': attr.ngModel,
'ng-disabled': attr.ngDisabled,
'ng-change': attr.ngChange,
'ng-required': attr.ngRequired,
'required': attr.required
}, function(value, name) {
if (angular.isDefined(value)) {
input.attr(name, value);
}
});
return function(scope, element, attr) {
scope.getValue = function() {
return scope.ngValue || attr.value;
};
};
}
};
});
.item-radio input:checked + .radio-content .item-content {
/* style the item content when its checked */
background: #f7f7f7;
}
.item-radio input:checked + .radio-content .radio-icon {
/* show the checkmark icon when its checked */
visibility: visible;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.