I have a UISegmentedControl and whenever I touch a button it should show an alert with the index of the segment currently selected:
- (IBAction)bOkayTouched:(id)sender
{
NSString *msg = [NSString stringWithFormat:#"%#", [scRPSSL selectedSegmentIndex]];
UIAlertView *lol = [[UIAlertView alloc] initWithTitle:#"Mkay" message:msg delegate:self cancelButtonTitle:#"Okay" otherButtonTitles:nil];
[lol show];
[lol release];
}
However, the app crashes when it must create the NSString. But it does not crash when I replace that line with:
NSString *msg = [NSString stringWithFormat:#"XD"];
or similar.
Oh, and here's what the debugger tells me:
[Session started at 2009-08-30 21:04:38 +0200.]
[Session started at 2009-08-30 21:04:43 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 4630.
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
(gdb)
Can anyone help me?
Also, the alert says '(null)' if the selected index is 0 (zero).
Thanks!
selectedSegmentIndex is likely an integer value, in which case the format string %# is not the right choice. Try the following instead:
[NSString stringWithFormat:#"%d", [scRPSSL selectedSegmentIndex]];
More information can be found in Apple's developer documentation on format specifiers, but the gist of it is that %# is used only for subclasses of NSObject. It works by calling [object description] which returns a string. If you use it on an integer value, you are essentially sending an Objective-C message to something that isn't an object, which results in undefined behaviour (usually a crash).
Related
I am trying to run an example Simulink model provided by Mathworks, but while deploying the model to the Pixhawk flight controller, I am receiving the following error:
Error(s) encountered while building "px4demo_uORBReadWrite":
### Failed to generate all binary outputs.
Caused by:
Validation error(s):
### Validating other build tools ...
Unable to locate build tool "GNU PX4 Archiver": echo
I have followed all the steps to configure the hardware properly, except the last part where I was not able to receive the accelerometer data too. The error received while testing the connection at that time was:
Error reading data from the serial port. Operation timed out before requested data was received.
Can someone explain why I am having this issue?
Thanks
I'm completely new to ipython/ jupyter, I literally just typed in me first example and went to save it. I'm not getting the error above?
Error: Load failed, save is disabled
Also I don't know if it is related but I can't left click into cells? I have to right click and then press escape (very annoying).
Thanks
Open up the Javascript developer console and read the error msg.
In my case it looked like:
Failed to load resource: the server responded with a status of 404 (Not Found)
main.min.js:12623 Object
main.min.js:12625 API request failed (404): No such file or directory: code/pcc/Prototype%%20Pattern.ipynb
main.min.js:26690 Error stack trace while loading notebook was:
main.min.js:26691 XhrError: No such file or directory: code/pcc/Prototype%%20Pattern.ipynb
at wrap_ajax_error (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:12671:29)
at Object.settings.error (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:12692:24)
at l (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:89:24882)
at Object.c.fireWith (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:89:25702)
at k (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:91:5373)
at XMLHttpRequest.<anonymous> (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:91:9152)
main.min.js:12030 Loaded extension: widgets/notebook/js/extension
I am trying to record audio with the PS Eye on a raspberry pi model b plus (I have tried with older b models and the same issue occurs as below).
I am able to record, and playback the recording with arecord/aplay so the mic is working. However, I want to increase the mic volume as the recording is very low.
When I attempt this in alsamixer, it exits with the following error when I use F6 to change to the PS Eye soundcard:
cannot load mixer controls: Invalid argument
I also notice that the alsa-utils service will fail when the PS Eye is plugged in (fine otherwise):
sudo service alsa-utils restart
[FAIL] Shutting down ALSA...warning: 'alsactl store' failed with error message 'alsactl: get_control:259: Cannot read control '2,0,0,Mic Capture Volume,0': Invalid argument'...failed.
[....] Setting up ALSA...warning: 'alsactl restore' failed with error message 'No state is present for card CameraB409241
Found hardware: "USB-Audio" "USB Mixer" "USB1415:2000" "" ""
Hardware is initialized using a generic method
No state is present for card CameraB409241'...amixer: Mixer hw:1 load error: Invalid argument
amixer: Mixer hw:1 load error: Invalid argument
amixer: Mixer hw:1 load error: Invalid argument
amixer: Mixer hw:1 load error: Invalid argument
amixer: Mixer hw:1 load error: Invalid argument
...
done.
The problem seems to be the controls definition of the PS Eye. I would like to know the following:
Where does alsamixer load the controls for a particular device from? Are they in the driver?
Is there a way to increase the mic volume another way?
I am not using Pulseaudio yet but will try it if I can't fix this in alsa.
thanks
Sytem logs:
Without pulseaudio installed, neither restarting alsa or trying to open the controls in alsamixer produce anything in the system log. If pulse audio is installed however, trying to open the controls in alsamixer gives:
Oct 30 10:21:26 signaler pulseaudio[19000]: [pulseaudio] alsa-util.c: Unable to load mixer: Invalid argument
Oct 30 10:21:27 signaler pulseaudio[19000]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Oct 30 10:21:27 signaler pulseaudio[19000]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Actually i am using push notification for my app but i am getting these warnings
"
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in /home/safeapp/public_html/QuickCheck/PushServiceTest.php on line 13
Warning: fwrite(): supplied argument is not a valid stream resource in /home/safeapp/public_html/QuickCheck/PushServiceTest.php on line 52
Warning: fwrite(): supplied argument is not a valid stream resource in /home/safeapp/public_html/QuickCheck/PushServiceTest.php on line 52
Warning: fclose(): supplied argument is not a valid stream resource in /home/safeapp/public_html/QuickCheck/PushServiceTest.php on line 58
"
i am pretty sure that code is ok and might be possible that there is some server functionality missing.i have checked that open ssl support is enabled.
Please help me and any small help will be highly appreciable.
Thanku
Hosting will have to enable “socket client” through .htaccess file. or enable complete open ssl support.
Anyone can give their comment on this answer.
here is the code: http://pastie.org/562956
this code crashes on the call to itemsArray.count on "didSelectRowAtIndexPath". I don't get why... itemsArray is accessed for other methods like "numberOfRowsInSection". why would it all of a sudden get dereferenced ( I assume that is what is happening).
here is the output (dunno what's up with "unable to read unknown load command 0x22" either)
[Session started at 2009-07-28 22:11:50 -0600.]
Warning - No location found for "NSUserDefaults-Optimize.m:81"
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 56173.
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
2009-07-28 22:11:55.545 Send2iPhone[56173:20b] Load items
2009-07-28 22:11:55.629 Send2iPhone[56173:20b] cellforrow 0
2009-07-28 22:11:55.634 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.644 Send2iPhone[56173:20b] cellforrow 1
2009-07-28 22:11:55.645 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.654 Send2iPhone[56173:20b] cellforrow 2
2009-07-28 22:11:55.658 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.659 Send2iPhone[56173:20b] cellforrow 3
2009-07-28 22:11:55.663 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:57.724 Send2iPhone[56173:20b] row = 0
Program received signal: “EXC_BAD_ACCESS”.
kill
quit
The Debugger has exited with status 0.(gdb)
Chuck has it right, you aren't retaining the array.
One fix is to make itemsArray a property of the controller so in the header
#interface RootViewController : UITableViewController {
NSArray *itemsArray;
NSString *test;
}
//add the property directive for itemsArray and tell it to use retain
#property (nonatomic, retain) NSArray *itemsArray;
and in the .m
#implementation RootViewController
// add the synthesize for itemsArray property
#synthesize itemsArray;
// when you set the value of itemsArray use self.itemsArray this will properly retain the array
self.itemsArray = [NSArray arrayWithContentsOfURL:plistURL];
// release the itemsArray in dealloc
- (void)dealloc {
[itemsArray release];
[super dealloc];
}
You are not claiming ownership of itemsArray, so it's being freed by the autorelease pool at some point. You could solve it by setting the variable using an accessor that properly retains and releases. Also, if you haven't, you should read the Cocoa memory management guidelines.