Titanium Mobile - Simulator exits without error - objective-c

I have following problem:
In my titanium project I save an image ( from UIView.toImage() ) to a file in applicationDirectory. Then I have a Obj-C module, where I read out that file.
Then an image processing algorithm is applied from a C++ Lib.
Before the algorithm is applied to the image I have a function which gets the ARGB-values from
the values I get from the file. I make a Pixel Matrix out of them.
Then, after the algorithm is applied I transform the new Pixel Matrix back into an UIImage to save it to a file.
My problem is, that sometimes the program crashes BEFORE the algorithm is applied (I use NSLogs to see where it crashes, that is right, isn't it? ) and sometimes the whole Obj-C Module finishes its work ...
I don't get any error message in the Titanium Console... Is there some way to see why I get the crashs or is there a way to debug my titanium project efficiently?

I debug the modules that I work on by running my test project in XCode. When the app crashes, XCode will break at some unhelpful spot. BUT what is helpful is the stack trace. I can usually clean enough information from that to figure out what is going wrong, and where.
Let me be explicit about "test project".
- If you are running your module by doing "titanium run" from the terminal, I will open the generated project in XCode and run it from there (you'll see the path to it in the generated log statements after you "titanium run" your module).
- Or, if you have your module as part of an actual project, build the project once, and open it in XCode. Run it, crash it, and you'll get a stack trace to help you on your way.
Another option would be for you to stick your really problematic code in some of the core Titanium Mobile code -- like in the PlatformModule.m. This is a module like your own, except its source code is right there. Then you'll be able set breakpoints, inspect your variables, and enjoy the full benefits of using XCode to see what's going on in your objective-c.
I hope this helps, and gets you on your way! Let me know if I can clarify anything further. -Dawson

Related

App doesn't launch after adding a method (Xcode 7.2)

I'm new to Cocoa and Mac programming so sorry if this is a bad question,but I got frustrated and I don't know what to do. Heres my ViewController files (Appdelegate.h and .m is left untouched to default)
Up to this point everything works as expected, App compiles and runs without a problem. but when I start adding some logic to a method updateDetailViews I get this:
How to fix it?
You can run your application removing the blue arrow. (Use drag and drop to remove).
It is use to check your function is called or not while your application is running. So when it call your application stop running and show this line. You can run again using the play type button from console.

XCode crashes on start up

Yes, this happens to people. Yes, I've looked at all the solutions.
This is different.
XCode starts and there is no error message, it just freezes. This is the screen I get:
That's it. No errors. I can't interact with it, I can't close it. The only thing I can do is use Show All Windows. There are five and yes I don't need them all (never did! don't know why I have them) but I can't close any of them. To get rid of it I need to do a hard reset.
I've tried deleting the library file in Finder as this was one of the solutions.
Nope.
Anyone any ideas?
I think it's XCode 6 (the latest) but I can't tell because I can't access the menu.
I ended up scouring Stackoverflow for ways to clear the startup process.
You hold cmd+shift when you start XCode - ONLY from the task bar, this does NOT work if you go into the Applications folder - and it will load blank.
Then you can load your project.

Xcode no longer recognizes tests

I've been troubleshooting this for a few days and am all out of ideas.
I was using unit testing in Xcode and it was working great. All of a sudden Xcode no longer recognizes my tests. If I go to the tests panel, it shows that I have zero tests. I actually have 13.
The ability to run individual tests or certain classes is now gone. It doesn't show the buttons in the gutter of the editor area.
I am still able to run all of my tests if I click the button to the right of the "0 Tests" in the test panel. When I click this it then starts populating all of my tests and they still appear to run properly. However, now that the tests are shown in the tests panel, they still are not linked to my tests in the classes. Usually if you click on a test, it will take you to it in the file where it lives. This functionality is gone.
I opened up another old project I had saved and it is having the same issue. However, I started a new project and it is working just fine and is showing no signs of any problems.
Any ideas as to what I may have done? I've found a few other threads out there about this on here, but none of them have gotten any helpful responses and are at least a number of months old. Hoping maybe creating a new thread will bump this again.
My next thought is to start the project over again and copy my files over. Not sure what else to do.
I had the same problem, and all my methods have the test prefix.
So, the problem is with Xcode indexing, as some targets could see all tests and some could not. To create a fresh index, follow these steps:
Quit Xcode
Go to ~/Library/Developer/Xcode/DerivedData/
Remove this folder. You can use rm -rf YourProjectDir
Done! When you open the project, wait for reindexing, and the tests should appear as usual.
All test method begin with "test":
func testValidateStudent()
{
// your code
}
make sure that your test methods begin with "test".
The test markers seem to be shown depending on the current scheme and whether the tests match that scheme.
(I tested that in Xcode 11, not sure about the time, when the question was asked originally. In my case I had to clear derived data to make the test markers appear again at all and then noticed the scheme dependency. The problem may have been triggered when I added a test with the same name to two different test targets.)
See screenshot below for a project with iOS and tvos targets. For instance the tests for the iOS target (on the left hand side in screenshot) will only be marked when the iOS target / scheme is selected. The tvos tests (on the right hand side in screenshot) will not show the markers in that case. Switching the scheme (red mark in top left) will hide the iOS test markers in the file on the left and show the tvos test markers in the file on the right.

When calling to NSOpenPanel's runModal, my application will not properly terminate

I'm writing a simple Cocoa Application, no core data or multiple document support. Running on a Mac Pro, OS X 10.6.6, Xcode 3.2.3.
I have reduced my application to the following code in my AppDelegate class:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel runModal];
return;
}
From within the debugger, I will run my application. As expected a somewhat not-to-useful OpenPanel will appear. I will click Cancel and it will disappear. All this is as expected. When I click [Command + Q] to Quit the application, the UI will go away but the debugger will indicate that the application is still running (as does the console output).
Based upon all the information I'm reading, I should not have to do anything else in order for this to run right. I've downloaded several examples on the Open Panel's usage but most use the deprecated methods of opening modal giving additional information as parameters. FWIW, I tried those methods and am still seeing the same result.
One last item, when the Open dialog appears, just for an instant I see a message box asking me something to the extent if I want my application to receive incoming connections. The dialog quickly disappears. I don't know if that is part of my problem or not. [Update - this deals with my Firewall being turned on.]
Yes, I'm fairly new at Objective C but not at programming in general. Any words of wisdom is greatly appreciated!
2011.02.07 - Update:
I have walked the debugger line by line without incident. There is no indication of any program failure in the console window.
I say that the debugger is still active after [Command + Q] because the Stop Process toolbar button is still enabled as is the Break button. Further the console indicates that after I tell the application to terminate (either via the menu or key command) that it is still running. The following is the Complete console output from start of run to after I Quit the application.
Program loaded.
run
[Switching to process 62370]
Running...
The Activity Monitor (system tool) will show my application terminating (no longer shows up as a process) but the Debugger will still not transition to "edit" mode - if I tell Xcode to run the debugger again, it will ask me if it's OK to Stop the current debugging session. If I was in Windows I would start looking for background threads keeping the process alive but as far as I know, NSOpenPanel should not be doing something like that.
I have further simplified the program to nothing more than creating a brand new Cocoa application and inserting the code snippet above - no other additions to the template project or updates in any way.
And lastly, when the application is run under the Leaks Performance Tool, everything runs fine when the panel is created but never used. When created and actually used though, at the end of the run I will get the following message in the tool "insufficient task_for_pid privileges (leakagent64)". Googling this hurts. If I read it right, the debugger does not have sufficient permissions to fully kill the target process ??? Now that sounds stupid but ... It does not make sense!
Another update - I just downloaded and ran FunHouse, one of the SDK sample applications that also uses NSOpenPanel. Well don't I feel special. It exhibits the same exact behavior. So from this I conclude either Apple has a bug in their code, my machine is special and messed up, and finally, it is Not my code that is at fault. That being the best part. Tomorrow, I will use a friends Mac and see if the same behavior is exhibited on his box.
This is just too weird.
I rebooted my box, took it to work and found it worked like a charm! I will assume this is fixed and has nothing to do with any other connected devices at home as compared to at work.
If it re-exhibits at home, then it is a network/device issue. Thanks all for your inputs and suggestions! Very much appreciated.
What, specifically, does the debugger say? It's possible that your program crashed, so the debugger is showing you information about the crash.
What if you omit any attempt to run an Open panel?

Error connecting to SQLite from iPhone

My application shows this error
asm CPSqliteConnectionStatementForSQL 0x30897lb3:10
and it stopped at this breakpoint in debugger
0x308971cb <+0024> mov 0x8(%edi),%eax
Does someone know about it?
The assembly code won't tell most of us anything at all, and your question is pretty light on detail about the context in which the problem occurs, such as what your app is trying to do when it crashes, whether this is always reproducible, etc. If you post more information we'll be able to help you more.
If you're debugging in Xcode, trace back up the call stack until you reach your code, then set a breakpoint there and debug your program again. When it stops at that point, try examining the related variables and see if they have the values you expect.
Edit: At the request of the asker, here is a slight clarification. When it stops at a breakpoint, the Xcode debugger window will look something like this: (from this section of Apple's Xcode Debugging Guide)
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeDebugging/art/debugger_disassembly.jpg
The stack frames are shown in the upper-left rectangle, and you can click on a row in the table to jump to that point in the code. Grayed-out lines are those that do not have viewable source code available. Scroll down until you see a line with black text and click on it. This will show you the point at which execution left your code and entered third-party code, and you can then examine variables to get a better idea about what the problem may be. If you have further questions, I highly recommend reading through the debugging guide linked above.