Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23778] iOS: Improve warning when calling iOS10 visual effects for Ti.UI.iOS.BlurView on < iOS10

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2016-08-15T23:58:56.000+0000
Affected Version/sRelease 5.5.0
Fix Version/sRelease 5.5.0
ComponentsiOS
Labelsqe-5.5.0
ReporterHarry Bryant
AssigneeHans Knöchel
Created2016-08-15T20:52:25.000+0000
Updated2016-08-16T20:24:18.000+0000

Description

Two new visual effects for iOS10 were exposed for Ti.UI.iOS.BlurView: Ti.UI.iOS.BLUR_EFFECT_STYLE_REGULAR Ti.UI.iOS.BLUR_EFFECT_STYLE_PROMINENT Currently, when running an app with these styles on a device < iOS10, the following error is returned:
[ERROR] Invalid type passed to function. expected: Number, was: NSNull -[TiUIiOSBlurView setEffect_:] (TiUIiOSBlurView.m:43)
It would be beneficial to handle this better through the form of a warning, stating that the currently selected style is not supported for the current iOS version.

TEST CODE:

var win = Ti.UI.createWindow({
    backgroundColor: "#fff"
});
 
// Reference image (or view)
var img = Ti.UI.createImageView({
    image: "/default_app_logo.png",
    top: 100,
    width: 300,
    height: 300
});
 
// Blur view
var blur = Ti.UI.iOS.createBlurView({
    width: Ti.UI.FILL,
    height: Ti.UI.FILL
});
 
img.add(blur);
 
// Effect controls
var tabs = Ti.UI.iOS.createTabbedBar({
    labels: ["Extra light", "Light", "Dark", "Regular", "Prominent"],
    bottom: 100
});
 
// Available blur effects
var effects = [
    Ti.UI.iOS.BLUR_EFFECT_STYLE_EXTRA_LIGHT,
    Ti.UI.iOS.BLUR_EFFECT_STYLE_LIGHT,
    Ti.UI.iOS.BLUR_EFFECT_STYLE_DARK,
    Ti.UI.iOS.BLUR_EFFECT_STYLE_REGULAR,
    Ti.UI.iOS.BLUR_EFFECT_STYLE_PROMINENT
];
 
tabs.addEventListener("click", function(e) {
    blur.setEffect(effects[e.index]);
});
 
win.add(tabs);
win.add(img);
win.open();

Steps to Reproduce

1. Create a new classic mobile application. 2. Copy test code to app.js file. 3. Build the app to an iOS device / sim < iOS10. 4. Launch the app and select "Regular" or "Prominent" buttons.

Actual Result

Error is returned to the console, which does not clearly describe the issue.

Expected Result

Appropriate warning message should be returned stating that the style is not supported for the current version.

Comments

  1. Hans Knöchel 2016-08-15

    The app will now log [ERROR] The provided value for the Ti.UI.BlurView.effect property is not available in this iOS version. if the provided effect is not available. PR (master): https://github.com/appcelerator/titanium_mobile/pull/8233 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8232 PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8231 Please use the demo-code above.
  2. Harry Bryant 2016-08-16

    Verified as fixed, the following warning is returned when calling an iOS10 visual effect for Ti.UI.iOS.BlurView on < iOS10:
       [ERROR] :  The provided value for the Ti.UI.iOS.BlurView.effect property is not available in this iOS version.
       
    Tested On: iPhone 6S (10.0, 9.3.4, 8.2) Device Mac OSX El Capitan 10.11.6 Ti SDK: 5.5.0.v20160816120242 Appc Studio: 4.7.0.201607250649 Appc NPM: 4.2.7 App CLI: 6.0.0-25 Xcode 8.0 beta 6 (8S193k) Node v4.4.7 *Closing ticket.*

JSON Source