[TIMOB-3309] iOS: Facebook Graph Method Crashes in some circumstances
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-18T09:16:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0, Sprint 2011-16 |
Components | iOS |
Labels | defect, ios, klist, release-1.7.0, reported-1.7.0, rplist |
Reporter | Rick Blalock |
Assignee | Stephen Tramer |
Created | 2011-04-15T03:41:51.000+0000 |
Updated | 2011-05-18T09:16:39.000+0000 |
Description
I've noticed several people trying to use certain properties that will crash the app. One such example:
HD Ticket here: http://developer.appcelerator.com/helpdesk/view/76207">http://developer.appcelerator.com/helpdesk/view/76207
Will crash the app:
var data = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference",
message: "Use Mozilla's online Javascript reference",
caption: "MDN Javascript Reference",
picture: "https://developer.mozilla.org/media/img/mdn-logo.png",
description: "This section of the site is dedicated to JavaScript-the-language, the parts that are not specific to web pages or other host environments...",
test: [ {foo: 'some test'} ]
};
Titanium.Facebook.requestWithGraphPath('me/feed', data, 'POST', function(e) {//...});
Exception thrown: http://pastie.org/1651703">http://pastie.org/1651703
Will crash the app with no exception:
var data = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference",
message: "Use Mozilla's online Javascript reference",
caption: "MDN Javascript Reference",
picture: "https://developer.mozilla.org/media/img/mdn-logo.png",
description: "This section of the site is dedicated to JavaScript-the-language, the parts that are not specific to web pages or other host environments...",
test: ['test']
};
Titanium.Facebook.requestWithGraphPath('me/feed', data, 'POST', function(e) {//...});
Will not crash the app:
var data = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference",
message: "Use Mozilla's online Javascript reference",
caption: "MDN Javascript Reference",
picture: "https://developer.mozilla.org/media/img/mdn-logo.png",
description: "This section of the site is dedicated to JavaScript-the-language, the parts that are not specific to web pages or other host environments...",
test: 'test'
};
Titanium.Facebook.requestWithGraphPath('me/feed', data, 'POST', function(e) {//...});
Even though 'test' property is irrelevant to the graph API, this should still not throw an exception from our side of things. Facebook does have a few properties that require an object literal / dictionary.
A more relavent test is the following, since the privacy api's expect this type of object:
Stack trace here: http://pastie.org/1723291">http://pastie.org/1723291
If a property is an object literal / dictionary it will throw the above exception. If it's an array, it will simply crash with no exception given.
The workaround for the above is as follows:
This will work fine as long as the object literal is actually a string.
klist'd, fixed reported-1.7.0 tag, set milestone to tbs
and assigned to Reggie
Fixed by commit fb31bd (https://github.com/appcelerator/titanium_mobile/commit/fb31bde75a145f4905393633e313226ba7729d33)
Neither of the two provided code samples crash iOS (iPhone 4, 4.3.3) or the simulator with 1.7.0RC1. Associated tests in KS also do not crash. Closing.