When Calabash iOS sends me ***** in its results, what does that mean? - ios

client: ruby-2.1.5/gems/calabash-cucumber-0.16.3
server: "version":"0.16.2"
I added some debugging around map(). A normal query returns this:
{:query=>"button marked:'Other options'", :method=>:query, :args=>[{:isEnabled=>1}], :r=>{"status_bar_orientation"=>"down", "results"=>["*****"], "outcome"=>"SUCCESS"}}
I don't know how to interpret *****.
In map.rb's assert_map_results "*****" is a failure case, so it's obviously bad.
In the simulator log, I see things like
Oct 12 17:37:57 TimBs-MacBook-Pro.local[36121]: -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7f7f6fe4f730
Oct 12 17:37:57 TimBs-MacBook-Pro.local[36121]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7f7f6fe4f730'
which I presume is it trying to decide whether it can apply isEnabled to the string "*****" instead of an object that behaves like a map.
Why on earth did they choose something so uninformative and pigging hard to web-search for?
Update: I originally had
element = "button marked:'game hot icon norm'"
element_exists(element) && query(element, :isEnabled).first.eql?(1)
but found a reference to
query("button isEnabled:1")
which I misread and adapted as query("button", isEnabled:1). This didn't help, but wasn't the cause of the "*****" results. Unfortunately, going back to a known good state, and gradually working back to the problem state, never caused the issue to re-appear, despite git saying there was no real difference. I can only suspect a dirty build.

This means you tried to call a unknown selector on an Objective-C object.
In this case, something is calling objectForKey: on an instance of NSString.
What is the query or gesture you are trying to run?
Is it:
query("button marked:'Other options'", [{:isEnabled => 1}])
If so, then the problem is that NSButton does not respond to isEnabled: (notice the trailing :). That is the accessor. The setter is: setEnabled:.
If you are trying to filter by enabled-ness:
query("button marked:'Other options'", :isEnabled)
If you are trying to set the enabled state:
query("button marked:'Other options'", [{:setEnabled => 1}])
Why on earth did they choose something so uninformative and pigging hard to web-search for?
It is difficult to change because Calabash is stuck in 0.x and uses semantic versioning so the API cannot be changed until a 1.x version. I believe (but I can't recall) Calabash 2.0 gives a better notice.

Related

Xcode with WebTrends - NSCFBoolean hasPrefix: unrecognized selector sent to instance

I made a game in Unity, and built it for iOS devices. The clients asked if we could implement WebTrends into the game, and so I followed this getting started guide for instructions on how to install it.
I was able to set it up, and got to Step 5, which suggests the following:
Lifecycle events can be logged automatically by setting the
wt_dc_automatics_enabled config setting to true
This is where I got stumped. I then added the above setting to my webtrends.plist, so it now looks like this:
When attempting to build and run that, I get an error in Xcode, and the game refuses to run:
Uncaught exception: NSInvalidArgumentException: -[__NSCFBoolean hasPrefix:]: unrecognized selector sent to instance 0x11294d238
This guide suggests setting wt_dc_enabled to true instead of wt_dc_automatics_enabled.
But even after replacing that in the plist, it returns the same error.
Notably, the project runs fine if I remove the wt_dc_automatics_enabled / wt_dc_enabled from the plist file, though it doesn't sent any logs, to my knowledge.
Is there anything else I can do?
Can you trying making wt_dc_automatics_enabled as String type and not boolean type and add its value as YES.
Because your error says somewhere in the code hasPrefix method is called on Boolean value. hasPrefix method is defined in String class and there is no such method in Boolean class.

Xcode how to debug unrecognized selector sent to instance

Ok so as far as i can tell I'm getting the error when I'm calling a setter designed to fit the view into it's correct box.
_parrentViewFrame = parrentViewFrame;
self.containerView.frame = _parrentViewFrame;
self.containerView.bounds = _parrentViewFrame;
[self.containerView layoutIfNeeded];
on the layoutIfNeeded i get this error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000343'
Now I've got similar code all over the app and it works just fine. I've put a symbolic break point at -[NSObject(NSObject) doesNotRecognizeSelector:]. but this doesn't really help. I still can't tell which object it's trying call length on. containerView is a simple UIView. The instance is always 0xb000000000000343, not sure if thats significant but it seems like it would be. How can I debug this problem?
One of two things might be going on:
As rmaddy pointed out, you may have assigned an NSNumber to a property that is not NSNumber. NSString seems like a likely candidate or an object that conforms to UILayoutSupport.
You might be overreleasing an object and an NSNumber is taking the place of that pointer, hence the bad selector call. If that is the case, you can turn on NSZombies, which will help you catch that overreleased object. Enable NSZombies in your scheme settings under Diagnostics.

Firguring out reasons for exceptions in Objective-C

After I completed the tutorial: Start Developing iOS Apps Today
I got the same exception asked here: IOS Tutorial Exception (ToDo Sample)
and the app crashed but it would not crash if I started a debugging session and stepped through the code.
2015-05-04 16:09:51.569 ToDoList[9223:67681] -[AddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7fe570d4eff0
2015-05-04 16:09:51.574 ToDoList[9223:67681] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7fe570d4eff0'
Then I solved the mystery by reading out this post: IOS Tutorial Exception (ToDo Sample)
The reason was that I wrongly connected the text field to the #implemenation section instead of to the #interface section and it created some method that I deleted. Of course I forgot about that soon after that.
How could I have figured out myself without knowing anything of the above what was the reason to get that exception and where it came from?
Log message is telling you that something was trying to call -textField: method of your AddToDoItemViewController.
So the first step would be to check if that method is implemented - in your case it was not. You might have been confused by the presence of
#property(weak, nonatomic) IBOutlet UITextField* textField
but auto synthesis for property generates getter with the signature -textField, which is different from -textField: (latter takes one parameter, while former none).
The exception says that you're trying to access the textView property of AddToDoItemViewController, but it doesn't have one.
So your next step would've been to go and check that you have a property like that declared and being an outlet that it's properly connected in the Interface Builder.
Edit:
Sorry I wasn't paying enough attention.
The selector that it's trying to call is textField: so it must be a function starting like that. I assume you set the controller as a TextView delegate but didn't implement the required method.

Why am I getting a `unrecognized selector sent to instance` error?

I have a Ruby on Rails application that has an API, it's an OAuth 2.0 provider and uses Doorkeeper. I am creating an iPhone client for that application and am using the gtm-oauth2 library for authentication. Here is the Github repository for the iPhone app.
I manage do the authentication request using the library and get the response from the OAuth server, but (I think that) when the iPhone app receives the response, the iPhone app crashes. I get the following error:
2013-03-25 07:30:51.563 Catapult for iOS[68917:c07] -[NSNull length]: unrecognized selector sent to instance 0x14f2678
2013-03-25 07:30:51.564 Catapult for iOS[68917:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x14f2678'
*** First throw call stack:
(0x13c1012 0x11e6e7e 0x144c4bd 0x13b0bbc 0x13b094e 0xf074 0x185e3 0x13b51bd 0x13b50d6 0x1531a 0x1512b 0x14ae2 0x13b51bd 0x13b50d6 0x11d0a 0x1032a 0x13b51bd 0x13b50d6 0x79be 0x77ed 0x8cf2 0xcec589 0xcea652 0xceb89a 0xcea60d 0xcea785 0xc37a68 0x4a2a911 0x4a29bb3 0x4a67cda 0x13638fd 0x4a6835c 0x4a682d5 0x4952250 0x1344f3f 0x1344a39 0x1367734 0x1366f44 0x1366e1b 0x22be7e3 0x22be668 0x12affc 0x2c6d 0x2b95)
libc++abi.dylib: terminate called throwing an exception
I am a complete noob/beginner when it comes to iOS development and Objective-C programming, and I am learning how to create my first app using this little project. I asked the same question in the gtm-oaut2 Google Group and according to them, the problem comes from my code and not the library. The problem is that all of my code is taken from their wiki and I can't pinpoint where the app crashes. If I understand correctly, at some point I am calling length of NSNull, but I am not calling length anywhere, hence my confusion. Also, when the app crashes, the line hilighted is in the main.m file and the error (on the right label, not in the output) is the following:
Thread 1: signal SIGABRT
I have no clue what that means...
Does anyone know what the problem might be please?
You're right that the issue is that somewhere you've got the length message being sent to an instance of NSNull. To pinpoint where exactly this is happening set a breakpoint on objc_exception_throw. You can do this in the Xcode UI with little "+" button in the bottom left corner on the breakpoints tab. Select "Add Exception breakpoint." Then the debugger will stop your program at the point where the error occurs instead of waiting for the program to actually crash.
Well... you understood the error correctly.. You are somewhere calling length on a NSNull instance.
I must find out where this is happening.
I think this is happening in a JSON response. Maybe you (or "the code") is calling length on something it expects its a NSString but it is instead NSNull (that is the json has a NULL value).
Try if you manage to print the json response and see if you found a key mapped to a null value...
NSNull does not respond to length
You can check the documentation for NSNull to see that this is the case.
Without having an idea of what your code base is doing I am not sure where to look, you must be calling [NSNull null]; at some point to get the NSNull object or you are using a framework somewhere that returns this.

ios understand the SIGABRT in my block

I have a block that fires once my image is downloaded. the data coming in from the block is the image. I'm not sure why I'm getting a SIGABRT though. This works fine on the first load, but when I come back to this same spot I always crash out the second time.
Everything you would want to see should be in the bottom left and printed out on the bottom right in the following order: data, ptr, ptr->imageImg
** EDIT **
I forgot to add the stack dump as well
2012-06-21 15:52:59.119 iPhone App[25327:16a03] -[UIImage length]: unrecognized selector sent to instance 0x10e41b80
2012-06-21 15:52:59.120 iPhone App[25327:16a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage length]: unrecognized selector sent to instance 0x10e41b80'
*** First throw call stack:
(0x1c35022 0x37dccd6 0x1c36cbd 0x1b9bed0 0x1b9bcb2 0x68e97a 0x5612c8 0x56102b 0x1be82 0x2afbc 0x46ad330 0x46af509 0x1b6c803 0x1b6bd84 0x1b6bc9b 0x1dc77d8 0x1dc788a 0x546626 0x28704 0x20d5)
terminate called throwing an exception(lldb)
You're calling length on UIImage, but UIImage doesn't have a method called length.
After hours of trying not to pull my hair out, I finally figured it out.
the situation
I have a caching system to cache a file on download and then send the stored version back to my callback. For some reason I was trying to save to a filepath that had a question mark (and other symbols) in it which apparently would NOT let ios save the file to the device *note xcode nor the device ever warned me that the file wasn't be saved either. However the record keeping system was showing that everything was working fine which meant the data sent back was empty NSData.
the solution
I made sure that my filepath had NO symbols in it when saving offline data and viola.

Resources