Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9224] Ti API: UI.Clipboard getText returns different values per platform when clipboard empty

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-09T16:50:55.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsTiAPI
Labelsparity
ReporterPaul Dowsett
AssigneeEric Merriman
Created2012-05-24T08:12:18.000+0000
Updated2017-06-09T16:50:55.000+0000

Description

Problem

The getText method of [Titanium.UI.Clipboard](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.Clipboard) returns different values on Android and iOS when the clipboard is empty: Android: empty string iOS: undefined

Test case

Titanium.UI.setBackgroundColor('#000');

Ti.API.log('Deleting all text in Clipboard');
Ti.UI.Clipboard.clearText();
Ti.API.log('Clipboard.getText() empty: ' + Ti.UI.Clipboard.getText()); // returns empty string on android and undefined on iOS when empty
Ti.API.log('Set text Clipboard to hello');
Ti.UI.Clipboard.setText('hello');
Ti.API.log('Clipboard.hasText(), should be true: ' + Ti.UI.Clipboard.hasText());
Ti.API.log('Clipboard.getText(), should be hello: ' + Ti.UI.Clipboard.getText());
Ti.API.log('Deleting all text in Clipboard');
Ti.UI.Clipboard.clearText();
Ti.API.log('Clipboard.getText() empty: ' + Ti.UI.Clipboard.getText()); // returns empty string on android and undefined on iOS when empty

Comments

  1. Lee Morris 2017-06-09

    Closing ticket due to time passed, any problems please open a new ticket.

JSON Source