iOS Titanium app crashes when scrolling TableView - crash

I am creating a simple chat app with Appcelerator Titanium to test the framework, and I use a simple TableView to show a list of messages. When I scroll the table so that a row that wasn't visible before is loaded, the app crashes instantly with a Objective-C trace (see below). I have absolutely no idea how to understand this, but most of the stack is obviously library code.
[ERROR] : The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] : Reason:
[ERROR] : -[__NSCFString absoluteString]: unrecognized selector sent to instance 0xae71df0
[ERROR] : Stack trace:
[ERROR] : 0 CoreFoundation 0x038fc012 __exceptionPreprocess + 178
[ERROR] : 1 libobjc.A.dylib 0x033bde7e objc_exception_throw + 44
[ERROR] : 2 CoreFoundation 0x039874bd -[NSObject(NSObject) doesNotRecognizeSelector:] + 253
[ERROR] : 3 CoreFoundation 0x038ebbbc ___forwarding___ + 588
[ERROR] : 4 CoreFoundation 0x038eb94e _CF_forwarding_prep_0 + 14
[ERROR] : 5 Mobile Chat 0x000e928b -[TiUIImageView loadUrl:] + 139
[ERROR] : 6 Mobile Chat 0x000eafe6 -[TiUIImageView setImage_:] + 902
[ERROR] : 7 libobjc.A.dylib 0x033d16b0 -[NSObject performSelector:withObject:] + 70
[ERROR] : 8 Mobile Chat 0x000f75f1 DoProxyDelegateReadKeyFromProxy + 321
[ERROR] : 9 Mobile Chat 0x000f7bf1 DoProxyDelegateReadValuesWithKeysFromProxy + 1137
[ERROR] : 10 Mobile Chat 0x00099f41 -[TiUIView readProxyValuesWithKeys:] + 65
[ERROR] : 11 Mobile Chat 0x00075427 -[TiViewProxy firePropertyChanges] + 167
[ERROR] : 12 Mobile Chat 0x00072c6e -[TiViewProxy view] + 1102
[ERROR] : 13 Mobile Chat 0x0017e8e5 -[TiUITableViewRowProxy redelegateViews:toView:] + 117
[ERROR] : 14 Mobile Chat 0x0018031f __43-[TiUITableViewRowProxy configureChildren:]_block_invoke_2 + 543
[ERROR] : 15 CoreFoundation 0x038f5e7c __NSArrayEnumerate + 572
[ERROR] : 16 CoreFoundation 0x038f5a16 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
[ERROR] : 17 CoreFoundation 0x038f5925 -[NSArray enumerateObjectsUsingBlock:] + 53
[ERROR] : 18 Mobile Chat 0x0017fd34 -[TiUITableViewRowProxy configureChildren:] + 2900
[ERROR] : 19 Mobile Chat 0x00180725 -[TiUITableViewRowProxy initializeTableViewCell:] + 293
[ERROR] : 20 Mobile Chat 0x000c7660 -[TiUITableView tableView:cellForRowAtIndexPath:] + 944
[ERROR] : 21 UIKit 0x012748fb -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 412
[ERROR] : 22 UIKit 0x012749cf -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 69
[ERROR] : 23 UIKit 0x0125d1bb -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1863
[ERROR] : 24 UIKit 0x0126db4b -[UITableView layoutSubviews] + 241
[ERROR] : 25 UIKit 0x0120a2dd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
[ERROR] : 26 libobjc.A.dylib 0x033d16b0 -[NSObject performSelector:withObject:] + 70
[ERROR] : 27 QuartzCore 0x02779fc0 -[CALayer layoutSublayers] + 240
[ERROR] : 28 QuartzCore 0x0276e33c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
[ERROR] : 29 QuartzCore 0x0276e150 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
[ERROR] : 30 QuartzCore 0x026ec0bc _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 324
[ERROR] : 31 QuartzCore 0x026ed227 _ZN2CA11Transaction6commitEv + 395
[ERROR] : 32 QuartzCore 0x026ed8e2 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 96
[ERROR] : 33 CoreFoundation 0x038c4afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[ERROR] : 34 CoreFoundation 0x038c4a3d __CFRunLoopDoObservers + 381
[ERROR] : 35 CoreFoundation 0x038a27c2 __CFRunLoopRun + 1106
[ERROR] : 36 CoreFoundation 0x038a1f44 CFRunLoopRunSpecific + 276
[ERROR] : 37 CoreFoundation 0x038a1e1b CFRunLoopRunInMode + 123
[ERROR] : 38 GraphicsServices 0x036837e3 GSEventRunModal + 88
[ERROR] : 39 GraphicsServices 0x03683668 GSEventRun + 104
[ERROR] : 40 UIKit 0x011b9ffc UIApplicationMain + 1211
[ERROR] : 41 Mobile Chat 0x000048f8 main + 456
[ERROR] : 42 Mobile Chat 0x00003205 start + 53
[ERROR] : 2013-09-24 10:49:02.969 Mobile Chat[35979:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString absoluteString]: unrecognized selector sent to instance 0xae71df0'
[ERROR] : *** First throw call stack:
[ERROR] : (0x38fc012 0x33bde7e 0x39874bd 0x38ebbbc 0x38eb94e 0xe928b 0xeafe6 0x33d16b0 0xf75f1 0xf7bf1 0x99f41 0x75427 0x72c6e 0x17e8e5 0x18031f 0x38f5e7c 0x38f5a16 0x38f5925 0x17fd34 0x180725 0xc7660 0x12748fb 0x12749cf 0x125d1bb 0x126db4b 0x120a2dd 0x33d16b0 0x2779fc0 0x276e33c 0x276e150 0x26ec0bc 0x26ed227 0x26ed8e2 0x38c4afe 0x38c4a3d 0x38a27c2 0x38a1f44 0x38a1e1b 0x36837e3 0x3683668 0x11b9ffc 0x48f8 0x3205)
-- End simulator log ---------------------------------------------------------
[ERROR] : An error occurred running the iOS Simulator
[ERROR] :
[ERROR] : Project failed to build after 12s 961ms
And here is the relevant code. It is a file whose function is called from app.js trough an navigation controller
var chatWindow = function(channelName) {
var chatRow = function(username, picture, message) {
var row = Titanium.UI.createTableViewRow();
var image = Titanium.UI.createImageView({
left: 5,
top: 5,
bottom: 5,
height: 50,
width: 50,
image: picture
});
var user = Titanium.UI.createLabel({
top: 5,
left: 60,
right: 5,
text: username,
font: {
fontWeight: "bold",
}
});
var msg = Titanium.UI.createLabel({
top: 30,
left: 60,
right: 5,
text: message
});
row.add(image);
row.add(user);
row.add(msg);
return row;
};
var window = Titanium.UI.createWindow({
width: Titanium.UI.FILL,
title: channelName,
backgroundColor: "#fff",
});
var container = Titanium.UI.createScrollView({
contentHeight: Titanium.UI.FILL,
contentWidth: Titanium.UI.FILL,
height: Titanium.UI.FILL,
width: Titanium.UI.FILL,
});
var textfield = Titanium.UI.createTextField({
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
width: Titanium.UI.FILL,
height: Titanium.UI.FILL,
bottom: 10,
left: 10,
right: 10,
height: 30,
returnKeyType: Titanium.UI.RETURNKEY_SEND
});
var messages = Titanium.UI.createTableView({
width: Titanium.UI.FILL,
bottom: 50,
top: 0
});
textfield.addEventListener("return", function() {
if (textfield.getValue() != "") {
messages.appendRow({title:textfield.getValue()});
textfield.setValue("");
}
});
textfield.addEventListener("focus", function() {
setTimeout(function() {container.setScrollingEnabled(false);}, 100);
});
textfield.addEventListener("blur", function() {
setTimeout(function() {container.setScrollingEnabled(true);}, 100);
});
container.add(messages);
container.add(textfield);
window.add(container);
var loop = function(dateNow) {
var d = new Date();
connect.ServerLink("getMessages",
{
channel: channelName,
startTime: d.getYear().toString().concat("-")
.concat(d.getMonth()).concat("-")
.concat(d.getDay()).concat("T")
.concat(d.getHours()).concat(":")
.concat(d.getMinutes()).concat(":")
.concat(d.getSeconds()).concat(".")
.concat(d.getMilliseconds()).concat("Z")
},
function(content) {
var json = JSON.parse(content);
var rows = [];
for (var i = json.length-1; i >= 0; i--) {
rows.push(chatRow(json[i].author, json[i].content));
Titanium.API.debug(json[i]);
}
rows.sort(function(a, b){
return (Date.parse(a.time)-Date.parse(b.time));
});
messages.setData(rows);
},
null);
setTimeout(loop, 2000);
};
loop();
return window;
};
Does anyone have a idea of what is causing this error?

From what I can see from a first quick look your function
var chatRow = function(username, picture, message) {...};
does not match the arguments you are passing to it
rows.push(chatRow(json[i].author, json[i].content));

Related

'java.lang.VerifyError: Stack map does not match the one at exception handler 70' while using sql-client of flink whith iceberg-runtime and hive

According to https://iceberg.apache.org/flink/ ,I use sql-client of flink with option -j:
bin/sql-client.sh embedded -j lib/flink-sql-connector-hive-2.3.6_2.11-1.11.3.jar -j lib/iceberg-flink-runtime-0.11.0.jar shell
and meet the following exception:
Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:213)
Caused by: org.apache.flink.table.client.gateway.SqlExecutionException: Could not create execution context.
at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:870)
at org.apache.flink.table.client.gateway.local.LocalExecutor.openSession(LocalExecutor.java:227)
at org.apache.flink.table.client.SqlClient.start(SqlClient.java:108)
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
Caused by: java.lang.VerifyError: Stack map does not match the one at exception handler 70
Exception Details:
Location:
org/apache/iceberg/hive/HiveCatalog.loadNamespaceMetadata(Lorg/apache/iceberg/catalog/Namespace;)Ljava/util/Map; #70: astore_2
Reason:
Type 'org/apache/hadoop/hive/metastore/api/NoSuchObjectException' (current frame, stack[0]) is not assignable to 'org/apache/thrift/TException' (stack map, stack[0])
Current Frame:
bci: #27
flags: { }
locals: { 'org/apache/iceberg/hive/HiveCatalog', 'org/apache/iceberg/catalog/Namespace' }
stack: { 'org/apache/hadoop/hive/metastore/api/NoSuchObjectException' }
Stackmap Frame:
bci: #70
flags: { }
locals: { 'org/apache/iceberg/hive/HiveCatalog', 'org/apache/iceberg/catalog/Namespace' }
stack: { 'org/apache/thrift/TException' }
Bytecode:
0x0000000: 2a2b b700 c59a 0016 bb01 2c59 1301 2e04
0x0000010: bd01 3059 032b 53b7 0133 bf2a b400 3e2b
0x0000020: ba02 8e00 00b6 00e8 c002 904d 2a2c b702
0x0000030: 944e b201 2213 0296 2b2d b902 5d01 00b9
0x0000040: 012a 0400 2db0 4dbb 012c 592c 1301 2e04
0x0000050: bd01 3059 032b 53b7 0281 bf4d bb01 3559
0x0000060: bb01 3759 b701 3813 0283 b601 3e2b b601
0x0000070: 4113 0208 b601 3eb6 0144 2cb7 0147 bf4d
0x0000080: b800 46b6 014a bb01 3559 bb01 3759 b701
0x0000090: 3813 0285 b601 3e2b b601 4113 0208 b601
0x00000a0: 3eb6 0144 2cb7 0147 bf
Exception Handler Table:
bci [27, 69] => handler: 70
bci [27, 69] => handler: 70
bci [27, 69] => handler: 91
bci [27, 69] => handler: 127
Stackmap Table:
same_frame(#27)
same_locals_1_stack_item_frame(#70,Object[#191])
same_locals_1_stack_item_frame(#91,Object[#191])
same_locals_1_stack_item_frame(#127,Object[#193])
at org.apache.iceberg.flink.CatalogLoader$HiveCatalogLoader.loadCatalog(CatalogLoader.java:112)
at org.apache.iceberg.flink.FlinkCatalog.<init>(FlinkCatalog.java:111)
at org.apache.iceberg.flink.FlinkCatalogFactory.createCatalog(FlinkCatalogFactory.java:127)
at org.apache.iceberg.flink.FlinkCatalogFactory.createCatalog(FlinkCatalogFactory.java:117)
at org.apache.flink.table.client.gateway.local.ExecutionContext.createCatalog(ExecutionContext.java:378)
at org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$null$5(ExecutionContext.java:626)
at java.util.HashMap.forEach(HashMap.java:1289)
at org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$initializeCatalogs$6(ExecutionContext.java:625)
at org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:264)
at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeCatalogs(ExecutionContext.java:624)
at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeTableEnvironment(ExecutionContext.java:523)
at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:183)
at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:136)
at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:859)
... 3 more
This appeares that something is wrong is jar version.
After attempts of try diffent flink version of hive version , still got this same issue .

NSURLSession crash

Just on one client device iPhone4s with iOS7.1 we have crash with stack:
Thread : Crashed: com.apple.NSURLSession-work
0 CoreFoundation 0x2d6419be CFURLCopyScheme + 49
1 CFNetwork 0x2d30b67d _urlIsHTTPish + 8
2 CFNetwork 0x2d30b67d _urlIsHTTPish + 8
3 CFNetwork 0x2d31f725 URLRequest::addOverridingSessionAttributes(_CFURLSessionConfiguration*) + 216
4 CFNetwork 0x2d374eb9 ClassicConnectionSession::createConnectionWithProperties(_CFURLRequest const*, __CFDictionary const*) const + 552
5 CFNetwork 0x2d35697d __73-[__NSCFLocalSessionBridge downloadTaskForRequest:resumeData:completion:]_block_invoke + 196
6 libdispatch.dylib 0x3844081f _dispatch_client_callout + 22
7 libdispatch.dylib 0x384467cb _dispatch_barrier_sync_f_invoke + 26
8 CFNetwork 0x2d2fbd89 -[__NSCFLocalSessionTask resume] + 100
Does anybody else had this?
EDIT:
Duplication of question: Asynchronous downloading in UICollectionView error with AFNetworking
CFURLCopyScheme crashed as CFURL passed to this method is nil, iOS7 does not check if url passed to NSURLSessionDownloadTask is valid.
Check that:
1) NSURL passed to request downloadTaskWithRequest was not nil
2) NSURL does not contain invalid characters e.g:
% |{}><"\`
This happened to me when I had a http proxy active (Charles with ssl) after trying to follow a redirect. The reason was an invalid redirect url in the 302 response.

Uncaught Error: no such table: test (code 1):

I'm using titanium and testing against an android emulator - but any advice relevant to iOs is also welcome! i am trying to use titanium with a database. I'm using the firefox sql lite plugin to make my db - so i make it, and then i go
var databasewindow=Ti.UI.createWindow({
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
backgroundColor:"#bb7711",
color:"#fff",
font: { fontSize:48 },
fontFamily:'BurnstownDam-Regular',
layout: 'vertical'
});
var db=Titanium.Database.install('test.sqlite','test');
db.close();
var db = Ti.Database.open('test');
//db.execute('INSERT INTO test(name,age) VALUES('Humayoon','25')');
db.execute('INSERT INTO test(name) VALUES ("Humayoon")');
//db.execute('INSERT INTO test("name","age") VALUES ("'+'Zohaib'+'","'+'23'+'")');
var sql=db.execute('SELECT * FROM test');
while (sql.isValidRow())
{
//var cityId = sql.fieldByName('id');
var Name = sql.fieldByName('name');
//var cityContinent = sql.fieldByName('age');
Ti.API.info(Name);
sql.next();
}
sql.close();
db.close();
databasewindow.open();
error here
[ERROR] : TiExceptionHandler: (main) [134,134] ----- Titanium
Javascript Runtime Error ----- [ERROR] : TiExceptionHandler: (main)
[0,134] - In app.js:15,4 [ERROR] : TiExceptionHandler: (main)
[1,135] - Message: Uncaught Error: no such table: test (code 1): ,
while compiling: INSERT INTO test(name) VALUES ("Humayoon") [ERROR] :
TiExceptionHandler: (main) [0,135] - Source: db.execute('INSERT INTO
test(name) VALUES ("Humayoon")'); [ERROR] : V8Exception: Exception
occurred at app.js:15: Uncaught Error: no such table: test (code 1):
, while compiling: INSERT INTO test(name) VALUES ("Humayoon") [ERROR]
: File: fail readDirectory() errno=2

CorePlot throws exceptions in iOS7 app / Xcode5

I have an iOS7 application that I am trying to integrate CorePlot 1.4 into (Dependent Project Install).
#property (nonatomic) CPTGraphHostingView *hostingView;
and
_hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectNull];
(_hostingView is subject to auto-layout.) If I then add a graph:
CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
_hostingView.hostedGraph = graph;
I first get this exception:
-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900'
5 myapp 0x00074325 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 1141
6 myapp 0x00075662 -[CPTAxis relabel] + 1202
In desperation I have then fixed this in updateAxisLabelsAtLocations:inRange:useMajorAxisLabels by:
NSDictionary *textAttributes = nil;
BOOL hasAttributedFormatter = FALSE;
and then get the next exception:
-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90'
5 myapp 0x00081520 -[CPTTextLayer sizeThatFits] + 320
6 myapp 0x0008163c -[CPTTextLayer sizeToFit] + 108
7 myapp 0x00080559 -[CPTTextLayer initWithText:style:] + 313
8 myapp 0x00074b87 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 3159
9 myapp 0x00075672 -[CPTAxis relabel] + 1202
I have then 'fixed' this by commenting out this line in sizeThatFits:
else {
// textSize = [myText sizeWithTextStyle:self.textStyle];
}
Next exception is then:
-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0'
5 myapp 0x00081dc8 -[CPTTextLayer renderAsVectorInContext:] + 1144
6 myapp 0x00063f60 -[CPTLayer drawInContext:] + 112
which is fixed by commenting out below code in renderAsVectorInContext:
else {
// [myText drawInRect:newBounds
// withTextStyle:self.textStyle
// inContext:context];
}
Now finally no exceptions are thrown and the graph borders are shown. But if I then begin to add data/legend, etc. new exceptions are thrown :(
No text is shown on the axis etc. Of course this is because I have commented out the code. But any clue why these exceptions are thrown? I am desperate ;S
It seems like I have missed something fundamental in the integration. But my integration (CorePlot 1.3 though) worked fine in an iOS6 app on Xcode4 some time ago.
Check the linker flags in your app project. Core Plot requires -ObjC and -all_load. See the Core Plot wiki for more information.

invokeSelector:withObject: crashes in Release

I have code
[target invokeSelector:handler.successAction withObject:object];
It may call some methods. With object or without. It perfectly works in Debug, but crashes in Release:
Nov 20 21:55:13 efpies project[7202] <Warning>: >>>> selector: successfulLogin
Nov 20 21:55:13 efpies project[7202] <Warning>: >>>> target: <AppDelegate: 0x1f595a90>
Nov 20 21:55:13 efpies project[7202] <Warning>: >>>> object: <7b226d65 73736167 65223a22 5c753034 31325c75 30343435 5c753034 33655c75 30343334 205c7530 3434305c 75303433 305c7530 3433375c 75303434 305c7530 3433355c 75303434 385c7530 3433355c 75303433 64227d> NSConcreteMutableData
Nov 20 21:55:13 efpies project[7202] <Error>: -[AppDelegate invokeSelector:withObject:]: unrecognized selector sent to instance 0x1f595a90
Nov 20 21:56:12 efpies project[7205] <Warning>: >>>> selector: driversUpdated:
Nov 20 21:56:12 efpies project[7205] <Warning>: >>>> target: <DriversList: 0x1cd5ffd0>
Nov 20 21:56:12 efpies project[7205] <Warning>: >>>> object: (
) __NSArrayM
Nov 20 21:56:12 efpies project[7205] <Error>: -[DriversList invokeSelector:withObject:]: unrecognized selector sent to instance 0x1cd5ffd0
Those methods are available (and even presented in header file). What's wrong? The data and objects are 100% correct
Use
[target performSelector:handler.successAction withObject:object];
That is the way to do this in cocoa-touch since NSObject will handle this for you.
Check Apple documentation for more details.
As it turned out, invokeSelector:withObject: is a category method in the static library. Categories from a static library don't load automatically so you should write
-force_load $(BUILD_ROOT)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/lib_name.a
to the Other linker flag field in target's Build settings if it compiles as dependency for the target.