Search Results

Search found 2362 results on 95 pages for 'foundation'.

Page 45/95 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • UIImagePickerController weirdness ...

    - by John Michael Zorko
    Hello, all ... UIImagePickerController is easy to use, but i'm all of a sudden finding it exasperating when I didn't find it so before. What's happening is that sometimes the imagePickerController:didFinishPickingImage:editingInfo delegate method does not seem to work -- the image will not show in the UIImageView even after the assignment was made. Sometimes it will, sometimes not, and furthermore, every single bit of example code i've tried (from the web, from the "Beginning iPhone 3 Development" book, etc.) exhibits the same problem. I'm at a loss as to why, and the problem happens on both my iPhone 3G as well as my 3GS, so I doubt that it's a hardware issue. These devices are running OS 3.1.2. The view controller is loaded from a xib file that contains one button and the UIImageView. I'd really like someone to tell me what stupid thing i'm obviously doing wrong :-) Here is the code -- i've tried to make the smallest app I could that exhibits the problem: #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface imagepickerViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate> { IBOutlet UIButton *button; IBOutlet UIImageView *imageView; } @property (nonatomic, retain) UIImageView *imageView; - (IBAction)takepic; - (void)usePic:(UIImage *)pic; @end #import "imagepickerViewController.h" @implementation imagepickerViewController @synthesize imageView; - (IBAction)takepic { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.delegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; } } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)info { [self usePic:image]; [picker dismissModalViewControllerAnimated:YES]; // after this method returns, the UIImageView should show the image -- yet very often it does not ... } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [picker dismissModalViewControllerAnimated:YES]; } - (void)usePic:(UIImage *)picture { imageView.image = picture; } @end

    Read the article

  • issues make a persistent object in Objective C

    - by oden
    Attempting to make a NSObject called 'Person' that will hold the login details for my application (nothing to fancy). The app is made of a navigation controller with multiple table views but I am having issues sharing the Person object around. Attempted to create a static object like this: + (Person *)sharedInstance { static Person *sharedInstance; @synchronized(self) { if(!sharedInstance) sharedInstance = [[Person alloc] init]; return sharedInstance; } return nil; } And here is the header // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject { NSString *fullName; NSString *firstName; NSString *lastName; NSString *mobileNumber; NSString *userPassword; } @property(nonatomic, retain) NSString *fullName; @property(nonatomic, retain) NSString *firstName; @property(nonatomic, retain) NSString *lastName; @property(nonatomic, retain) NSString *mobileNumber; @property(nonatomic, retain) NSString *userPassword; + (Person *)sharedInstance; -(BOOL) setName:(NSString*) fname; -(BOOL) setMob:(NSString*) mnum; -(BOOL) setPass:(NSString*) pwd; @end This object setters and getters are needed in different parts of the application. I have been attempting to access them like this Person * ThePerson = [[Person alloc] init]; ThePerson = nil; NSString * PersonsName; PersonsName = [[Person sharedInstance] firstName]; Everything works well at the login screen but it dies at the next use. usually EXC_BAD_ACCESS (eek!). Clearly I am doing something very wrong here. Is there an easier way to share objects between different a number view controllers (both coded and xib)?

    Read the article

  • VBS Runtime error code 800A01B6

    - by salvationishere
    I am a newbie to VBS scripting. I am getting above error on line 54, character 5 in script below. This error says "Object doesn't support this property or method: 'MimeMapArray'". And line it is referring to is: MimeMapArray(i) = CreateObject("MimeMap") Can u tell me what I am doing wrong? Here is the script in its entirety. Note, I am trying to run this on an XP OS by double-clicking this VBS file. ' This script adds the necessary Windows Presentation Foundation MIME types ' to an IIS Server. ' To use this script, just double-click or execute it from a command line. ' Running this script multiple times results in multiple entries in the IIS MimeMap. ' Set the MIME types to be added Dim MimeMapObj Dim MimeMapArray Dim WshShell Dim oExec Const ADS_PROPERTY_UPDATE = 2 Dim MimeTypesToAddArray MimeTypesToAddArray = Array(".manifest", "application/manifest", ".xaml", _ "application/xaml+xml", ".application", "application/x-ms-application", _ ".deploy", "application/octet-stream", ".xbap", "application/x-ms-xbap", _ ".xps", "application/vnd.ms-xpsdocument") ' Get the mimemap object Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap") ' Call AddMimeType for every pair of extension/MIME type For counter = 0 to UBound(MimeTypesToAddArray) Step 2 AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1) Next ' Create a Shell object Set WshShell = CreateObject("WScript.Shell") ' Stop and Start the IIS Service Set oExec = WshShell.Exec("net stop w3svc") Do While oExec.Status = 0 WScript.Sleep 100 Loop Set oExec = WshShell.Exec("net start w3svc") Do While oExec.Status = 0 WScript.Sleep 100 Loop Set oExec = Nothing ' Report status to user WScript.Echo "Windows Presentation Foundation MIME types have been registered." ' AddMimeType Sub Sub AddMimeType(ByVal Ext, ByVal MType) ' Get the mappings from the MimeMap property. MimeMapArray = MimeMapObj.GetEx("MimeMap") ' Add a new mapping. i = UBound(MimeMapArray) + 1 ReDim Preserve MimeMapArray(i) MimeMapArray(i) = CreateObject("MimeMap") MimeMapArray(i).Extension = Ext MimeMapArray(i).MimeType = MType MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray MimeMapObj.SetInfo() End Sub

    Read the article

  • iPhone UnitTesting UITextField value and otest error 133

    - by Justin Galzic
    Are UITextFields not meant to be part of the LogicTests and instead part of the ApplicationTest target? I have a factory class that is responsible for creating and returning an (iPhone) UITextField and I'm trying to unit test it. It is part of my Logic Test target and when I try to build and run the tests, I get a build error about: /Developer/Tools/RunPlatformUnitTests.include:451:0 Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/ 'Developer/usr/bin/otest' exited abnormally with code 133 (it may have crashed). In the build window, this points to the following line in: "RunPlatformUnitTests.include" RPUTIFail ${LINENO} "Test rig '${TEST_RIG}' exited abnormally with code ${TEST_RIG_RESULT} (it may have crashed)." My unit test looks like this: #import <SenTestingKit/SenTestingKit.h> #import <UIKit/UIKit.h> // Test-subject headers. #import "TextFieldFactory.h" @interface TextFieldFactoryTests : SenTestCase { } @end @implementation TextFieldFactoryTests #pragma mark Test Setup/teardown - (void) setUp { NSLog(@"%@ setUp", self.name); } - (void) tearDown { NSLog(@"%@ tearDown", self.name); } #pragma mark Tests - (void) testUITextField_NotASecureField { NSLog(@"%@ start", self.name); UITextField *textField = [TextFieldFactory createTextField:YES]; NSLog(@"%@ end", self.name); } The class I'm trying to test: // Header file #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface TextFieldFactory : NSObject { } +(UITextField *)createTextField:(BOOL)isSecureField; @end // Implementation file #import "TextFieldFactory.h" @implementation TextFieldFactory +(UITextField *)createTextField:(BOOL)isSecureField { // x,y,z,w are constants declared else where UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(x, y, z, w)] autorelease]; // some initialization code return textField; } @end

    Read the article

  • OCUnit & NSBundle

    - by kpower
    I created OCUnit test in concordance with "iPhone Development Guide". Here is the class I want to test: // myClass.h #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface myClass : NSObject { UIImage *image; } @property (readonly) UIImage *image; - (id)initWithIndex:(NSUInteger)aIndex; @end // myClass.m #import "myClass.m" @implementation myClass @synthesize image; - (id)init { return [self initWithIndex:0]; } - (id)initWithIndex:(NSUInteger)aIndex { if ((self = [super init])) { NSString *name = [[NSString alloc] initWithFormat:@"image_%i", aIndex]; NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"png"]; image = [[UIImage alloc] initWithContentsOfFile:path]; if (nil == image) { @throw [NSException exceptionWithName:@"imageNotFound" reason:[NSString stringWithFormat:@"Image (%@) with path \"%@\" for current index (%i) wasn't found.", [name autorelease], path, aIndex] userInfo:nil]; } [path release]; } return self; } - (void)dealloc { [image release]; [super dealloc]; } @end And my unit-test (LogicTests target): // myLogic.m #import <SenTestingKit/SenTestingKit.h> #import <UIKit/UIKit.h> #import "myClass.h" @interface myLogic : SenTestCase { } - (void)testTemp; @end @implementation myLogic - (void)testTemp { STAssertNoThrow([[myClass alloc] initWithIndex:0], "myClass initialization error"); } @end All necessary frameworks, "myClass.m" and images added to target. But on build I have an error: [[myClass alloc] initWithIndex:0] raised Image (image_0) with path \"(null)\" for current index (0) wasn't found.. myClass initialization error This code (initialization) works fine in application itself (main target) and later displays correct image. I've also checked my project folder (build/Debug-iphonesimulator/LogicTests.octest/) - there are LogicTests, Info.plist and necessary image files (image_0.png is one of them). What's wrong?

    Read the article

  • how to extend a protocol for a delegate in objective C, then subclass an object to require a conform

    - by fess .
    I want to subclass UITextView, and send a new message to the delegate. So, I want to extend the delegate protocol, What's the correct way to do this? I started out with this: interface: #import <Foundation/Foundation.h> @class MySubClass; @protocol MySubClassDelegate <UITextViewDelegate> - (void) MySubClassMessage: (MySubClass *) subclass; @end @interface MySubClass : UITextView { } @end implementation: #import "MySubClass.h" @implementation MySubClass - (void) SomeMethod; { if ([self.delegate respondsToSelector: @selector (MySubClassMessage:)]) { [self.delegate MySubClassMessage: self]; } } @end however with that I get the warning: '-MySubClassMessage:' not found in protocol(s). I had one way working where I created my own ivar to store the delegate, then also stored the delegate using [super setDelegate] but that seemed wrong. perhaps it's not. I know I can just pass id's around and get by, but My goal is to make sure that the compiler checks that any delegate supplied to MySubClass conforms to MySubClassDelegate protocol. To further clairfy: @interface MySubClassTester : NSObject { } @implementation MySubClassTester - (void) one { MySubClass *subclass = [[MySubClass alloc] init]; subclass.delegate = self; } @end will produce the warning: class 'MySubClassTester' does not implement the 'UITextViewDelegate' protocol I want it to produce the warning about not implementing 'MySubClassDelegate' protocol instead. Thanks, a bunch. (thanks brad)

    Read the article

  • How to implement Excel Solver functionality in C#?

    - by Vic
    Hi, I have an application in C#, I need to do some optimization calculations, like Excel Solver Add-in does, one option is certainly to write my own solver implementation, but I'm kind of short of time, so I'm looking into libraries that already exist that can help me with this. I've been trying the Microsoft Solver Foundation, which seems pretty neat and cool, the problem is that it doesn't seem to work with the kind of calculations that I need to do. At the end of this question I'm adding the information about the calculations I need to perform and optimize. So basically my question is if any of you know of any other library that I can use for this purpose, or any tutorial that can help to do my own solver, or any idea that gives me a lead to solve this issue. Thanks. Additional Info: This is the data I need to calculate: I have 7 variables, lets call them var1, var2,...,var7 The constraints for these variables are: All of them need to be 0 <= varn <= 0.5 (where n is the number of the variable) The sum of all the variables should be equal to 1 The objective is to maximize the target formula, which in Excel looks like this: (MMULT(TRANSPOSE(L26:L32),M14:M20)) / (SQRT(MMULT(MMULT(TRANSPOSE(L26:L32),M4:S10),L26:L32))) The range that you see in this formula, L26:L32, is actually the range with the variables from above, var1, var2,..., varn. M14:M20 and M4:S10 are ranges with data that I get from different sources, there are more likely decimal values. As I said before, I was using Microsoft Solver Foundation, I modeled pretty much everything with it, I created functions that handle the operations of the target formula, but when I tried to solve the model it always fail, I think it is because of the complexity of the operations. In any case, I just wanted to show these data so you can have an idea about the kind of calculations that I need to implement.

    Read the article

  • Why can't I initialize a class through a setter?

    - by Rob emenaker
    If I have a custom class called Tires: #import <Foundation/Foundation.h> @interface Tires : NSObject { @private NSString *brand; int size; } @property (nonatomic,copy) NSString *brand; @property int size; - (id)init; - (void)dealloc; @end ============================================= #import "Tires.h" @implementation Tires @synthesize brand, size; - (id)init { if (self = [super init]) { [self setBrand:[[NSString alloc] initWithString:@""]]; [self setSize:0]; } return self; } - (void)dealloc { [super dealloc]; [brand release]; } @end And I synthesize a setter and getter in my View Controller: #import <UIKit/UIKit.h> #import "Tires.h" @interface testViewController : UIViewController { Tires *frontLeft, *frontRight, *backleft, *backRight; } @property (nonatomic,copy) Tires *frontLeft, *frontRight, *backleft, *backRight; @end ==================================== #import "testViewController.h" @implementation testViewController @synthesize frontLeft, frontRight, backleft, backRight; - (void)viewDidLoad { [super viewDidLoad]; [self setFrontLeft:[[Tires alloc] init]]; } - (void)dealloc { [super dealloc]; } @end It dies after [self setFrontLeft:[[Tires alloc] init]] comes back. It compiles just fine and when I run the debugger it actually gets all the way through the init method on Tires, but once it comes back it just dies and the view never appears. However if I change the viewDidLoad method to: - (void)viewDidLoad { [super viewDidLoad]; frontLeft = [[Tires alloc] init]; } It works just fine. I could just ditch the setter and access the frontLeft variable directly, but I was under the impression I should use setters and getters as much as possible and logically it seems like the setFrontLeft method should work. This brings up an additional question that my coworkers keep asking in these regards (we are all new to Objective-C); why use a setter and getter at all if you are in the same class as those setters and getters.

    Read the article

  • How to make a Global Array?

    - by Wayfarer
    So, I read this post, and it's pretty much exactly what I was looking for. However... it doesn't work. I guess I'm not going to go with the singleton object, but rather making the array in either a Global.h file, or insert it into the _Prefix file. Both times I do that though, I get the error: Expected specifier-qualifier-list before 'static' and it doesn't work. So... I'm not sure how to get it to work, I can remove extern and it works, but I feel like I need that to make it a constant. The end goal is to have this Mutable Array be accessible from any object or any file in my project. Help would be appreciated! This is the code for my Globals.h file: #import <Foundation/Foundation.h> @interface Globals : NSObject { static extern NSMutableArray * myGlobalArray; } @end I don't think I need anything in the implementation file. If I were to put that in the prefix file, the error was the same.

    Read the article

  • Objective C, Linking Error with extern variable..

    - by LCYSoft
    I have a very simple java code like this. I don't have any idea how to do this in Objective C. Especially, the static part which calls the getLocalAddress() method and assign it into the static string variable. I know how to set a static variable and a static method in Objective but I dont know how to implement that static { } part in java. Thanks in advance... public class Address { public static String localIpAddress; static { localIpAddress = getLocalIpAddress(); } public Address() { } static String getLocalIpAddress() { //do something to get local ip address } } I added this in my .h file #import <Foundation/Foundation.h> extern NSString *localIpAddress; @class WifiAddrss; @interface Address : NSObject { } @end And my .m file looks like #import "Address.h" #import "WifiAddress.h" @implementation Address +(void)initialize{ if(self == [Address class]){ localIpAddress = [self getLocalIpAddress]; } } +(NSString *)getLocalIpAddress{ return address here } -(id)init{ self = [super init]; if (self == nil){ NSLog(@"init error"); } return self; } @end And Now I am getting a linking error and it complains about "extern NSString *localIpAddress" part. If I change the extern to static, it works fine. But what I wanted to do is that I want make the scope of "localIpAddress" variable as grobal. Since if I put "static" in front of a variable in Objective-C then the variable is only visible in the class. But this time, I want to make that as a grobal variable. So my question is how to make "localIpAddress" variable as a grobal variable which is initialized once when the first time Address class is created.. Thanks in advance...

    Read the article

  • Why I got a "sent to freed object error"?

    - by Tattat
    I have a Table View, and CharTableController, the CharTableController works like this: .h: #import <Foundation/Foundation.h> @interface CharTableController : UITableViewController <UITableViewDelegate, UITableViewDataSource>{ // IBOutlet UILabel *debugLabel; NSArray *listData; } //@property (nonatomic, retain) IBOutlet UILabel *debugLabel; @property (nonatomic, retain) NSArray *listData; @end The .m: #import "CharTableController.h" @implementation CharTableController @synthesize listData; - (void)viewDidLoad { NSArray *array = [[NSArray alloc] initWithObjects:@"Sleepy", @"Sneezy", @"Bashful", @"Happy", @"Doc", @"Grumpy", @"Dopey", @"Thorin", @"Dorin", @"Nori", @"Ori", @"Balin", @"Dwalin", @"Fili", @"Kili", @"Oin", @"Gloin", @"Bifur", @"Bofur", @"Bombur", nil]; self.listData = array; [array release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; } return cell; } @end And I Use the IB to link the TableView's dataSource and delegate to the CharTableController. In the CharTableController's view is the TableView in IB obviously. Reference Object in dataSource TableView and delegate TableView. What's wrong with my setting? thz.

    Read the article

  • Objective-C: How to access methods in other classes

    - by Adam
    I have what I know is a simple question, but after many searches in books and on the Internet, I can't seem to come up with a solution. I have a standard iPhone project that contains, among other things, a ViewController. My app works just fine at this point. I now want to create a generic class (extending NSObject) that will have some basic utility methods. Let's call this class Util.m (along with the associated .h file). I create the Util class (and .h file) in my project, and now I want to access the methods contained in that class class from my ViewController. Here's an example of a simple version of Util.h #import <Foundation/Foundation.h> @interface Util : NSObject { } - (void)myMethod; @end Then the Util.m file would look something like this: #import "Util.h" @implementation Util - (void)myMethod { NSLog(@"myMethod Called"); } @end Now that my Util class is created, I want to call the "myMethod" method from my ViewController. In my ViewController's .h file, I do the following: #import "Util.h" @interface MyViewController : UIViewController { Util *utils; } @property (assign) Util *utils; @end Finally, in the ViewController.m, I do the following: #import "Util.h" @implementation MyViewController @synthesize utils; - (void)viewDidLoad { [super viewDidLoad]; utils.myMethod; //this doesn't work [utils myMethod]; //this doesn't work either NSLog(@"utils = %@", utils); //in the console, this prints "utils = (null)" } What am I doing wrong? I'd like to not only be able to directly reference other classes/methods in a simple util class like this, but I'd also like to directly reference other ViewControllers and their properties and methods as well. I'm stumped! Please Help.

    Read the article

  • ASIHTTPRequest wrapper usage for Macs

    - by Rob
    I am trying to apply the ASIHTTPRequest wrapper to a very basic Objective C program. I have already copied over the necessary files into my program and after giving myself an extreme headache trying to figure out how it works through their website I thought I would post a question on here. The files copied over were: ASIHTTPRequestConfig.h ASIHTTPRequestDelegate.h ASIProgressDelegate.h ASIInputStream.h ASIInputStream.m ASIHTTPRequest.h ASIHTTPRequest.m ASIFormDataRequest.h ASIFormDataRequest.m My program is very basic: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // Defining the various variables. char firstName[20]; char lastName[20]; char rank[5]; int leaveAccrued; int leaveRequested; // User Input. NSLog (@"Please input First Name:"); scanf("%s", &firstName); NSLog (@"Please input Last Name:"); scanf("%s", &lastName); NSLog (@"Please input Rank:"); scanf("%s", &rank); NSLog (@"Please input the number leave days you have accrued:"); scanf("%i", &leaveAccrued); NSLog (@"Please input the number of leave days you are requesting:"); scanf("%i", &leaveRequested); // Print results. NSLog (@"Name: %s %s", firstName, lastName); NSLog (@"Rank: %s", rank); NSLog (@"Leave Accrued: %i", leaveAccrued); NSLog (@"Leave Requested: %i", leaveRequested); [pool drain]; return 0; } How do I utilize the wrapper to export these 5 basic variables to a web server via an http request?

    Read the article

  • Thread-local storage segfaults on NetBSD only?

    - by bortzmeyer
    Trying to run a C++ program, I get segmentation faults which appear to be specific to NetBSD. Bert Hubert wrote the simple test program (at the end of this message) and, indeed, it crashes only on NetBSD. % uname -a NetBSD golgoth 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Oct 1 15:46:16 CEST 2009 +stephane@golgoth:/usr/obj/sys/arch/i386/compile/GENERIC i386 % g++ --version g++ (GCC) 4.1.3 20080704 prerelease (NetBSD nb2 20081120) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % gdb thread-local-storage-powerdns GNU gdb 6.5 Copyright (C) 2006 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--netbsdelf"... (gdb) run Starting program: /home/stephane/Programmation/C++/essais/thread-local-storage-powerdns Program received signal SIGSEGV, Segmentation fault. 0x0804881b in main () at thread-local-storage-powerdns.cc:20 20 t_a = new Bogo('a'); (gdb) On other Unix, it works fine. Is there a known issue in NetBSD with C++ thread-local storage? #include <stdio.h> class Bogo { public: explicit Bogo(char a) { d_a = a; } char d_a; }; __thread Bogo* t_a; int main() { t_a = new Bogo('a'); Bogo* b = t_a; printf("%c\n", b->d_a); }

    Read the article

  • Subclassing UIButton but can't access my properties

    - by Ross Ellerington
    Hi, I've created a sub class of UIButton: // // DetailButton.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> @interface MyDetailButton : UIButton { NSObject *annotation; } @property (nonatomic, retain) NSObject *annotation; @end // // DetailButton.m // #import "MyDetailButton.h" @implementation MyDetailButton @synthesize annotation; @end I figured that I can then create this object and set the annotation object by doing the following: MyDetailButton* rightButton = [MyDetailButton buttonWithType:UIButtonTypeDetailDisclosure]; rightButton.annotation = localAnnotation; localAnnotation is an NSObject but it is really an MKAnnotation. I can't see why this doesn't work but at runtime I get this error: 2010-05-27 10:37:29.214 DonorMapProto1[5241:207] *** -[UIButton annotation]: unrecognized selector sent to instance 0x445a190 2010-05-27 10:37:29.215 DonorMapProto1[5241:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButton annotation]: unrecognized selector sent to instance 0x445a190' ' I can't see why it's even looking at UIButton because I've subclassed that so it should be looking at the MyDetailButton class to set that annotation property. Have I missed something really obvious. It feels like it :) Thanks in advance for any help you can provide Ross

    Read the article

  • Help creating custom iPhone Classes

    - by seanny94
    This should be a simple question, but I just can't seem to figure it out. I'm trying to create my own class which will provide a simpler way of playing short sounds using the AudioToolbox framework as provided by Apple. When I import these files into my project and attempt to utilize them, they just don't seem to work. I was hoping someone would shed some light on what I may be doing wrong here. simplesound.h #import <Foundation/Foundation.h> @interface simplesound : NSObject { IBOutlet UILabel *statusLabel; } @property(nonatomic, retain) UILabel *statusLabel; - (void)playSimple:(NSString *)url; @end simplesound.m #import "simplesound.h" @implementation simplesound @synthesize statusLabel; - (void)playSimple:(NSString *)url { if (url = @"vibrate") { AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); statusLabel.text = @"VIBRATED!"; } else { NSString *paths = [[NSBundle mainBundle] resourcePath]; NSString *audioF1ile = [paths stringByAppendingPathComponent:url]; NSURL *audioURL = [NSURL fileURLWithPath:audioFile isDirectory:NO]; SystemSoundID mySSID; OSStatus error = AudioServicesCreateSystemSoundID ((CFURLRef)audioURL,&mySSID); AudioServicesAddSystemSoundCompletion(mySSID,NULL,NULL,simpleSoundDone,NULL); if (error) { statusLabel.text = [NSString stringWithFormat:@"Error: %d",error]; } else { AudioServicesPlaySystemSound(mySSID); } } static void simpleSoundDone (SystemSoundID mySSID, void *args) { AudioServicesDisposeSystemSoundID (mySSID); } } - (void)dealloc { [url release]; } @end Does anyone see what I'm trying to accomplish here? Does anyone know how to remedy this code that is supposedly wrong?

    Read the article

  • crash log in device

    - by seenu
    I need help to understand the crash log. The app works fine on my simulator but it crashes in device. my simulator is run with:-iPhone Simulator 225, iPhone OS 4.1 (iPhone 4/8B5091b) this is my device crash log:- Incident Identifier: CD0E8B93-5CF9-402C-9787-4B175C51A690 CrashReporter Key: 1961913be3204fe8cb5a39c1e00ac0f03a452876 Hardware Model: iPhone1,2 Process: My Game[1115] Path: /var/mobile/Applications/2968E5FB-96DD-443D-B386-D68F08E9345E/My Game.app/My Game Identifier: My Game Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2010-12-29 23:39:15.753 -0500 OS Version: **iPhone OS 4.2.1 (8C148)** Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x35de3ad0 0x35d5a000 + 563920 1 libSystem.B.dylib 0x35de3abe 0x35d5a000 + 563902 2 libSystem.B.dylib 0x35de3ab2 0x35d5a000 + 563890 3 libSystem.B.dylib 0x35dfad5e 0x35d5a000 + 658782 4 libstdc++.6.dylib 0x374f2a00 0x3748d000 + 416256 5 libobjc.A.dylib 0x32d9d8d8 0x32d95000 + 35032 6 libstdc++.6.dylib 0x374f0100 0x3748d000 + 405760 7 libstdc++.6.dylib 0x374f0178 0x3748d000 + 405880 8 libstdc++.6.dylib 0x374f02a0 0x3748d000 + 406176 9 libobjc.A.dylib 0x32d9bf28 0x32d95000 + 28456 10 CoreFoundation 0x3759dabc 0x374f9000 + 674492 11 Foundation 0x351a3e6c 0x35151000 + 339564 12 My Game 0x0006325c 0x1000 + 402012 13 My Game 0x00003c98 0x1000 + 11416 14 My Game 0x00062108 0x1000 + 397576 15 My Game 0x00003b08 0x1000 + 11016 16 My Game 0x000074d8 0x1000 + 25816 17 CoreFoundation 0x375466fc 0x374f9000 + 317180 18 CoreFoundation 0x375465d6 0x374f9000 + 316886 19 My Game 0x0005c818 0x1000 + 374808 20 My Game 0x000596a4 0x1000 + 362148 21 CoreFoundation 0x37542a3c 0x374f9000 + 301628 22 My Game 0x000b692c 0x1000 + 743724 23 My Game 0x000b7550 0x1000 + 746832 24 My Game 0x000c2a7c 0x1000 + 793212 25 UIKit 0x358f4ea8 0x358d3000 + 138920 26 UIKit 0x358f44dc 0x358d3000 + 136412 27 UIKit 0x358d7c94 0x358d3000 + 19604 28 UIKit 0x358d73ac 0x358d3000 + 17324 29 GraphicsServices 0x33e77c80 0x33e72000 + 23680 30 CoreFoundation 0x3752f5c4 0x374f9000 + 222660 31 CoreFoundation 0x3752f582 0x374f9000 + 222594 32 CoreFoundation 0x3752182e 0x374f9000 + 165934 33 CoreFoundation 0x37521504 0x374f9000 + 165124 34 CoreFoundation 0x37521412 0x374f9000 + 164882 35 GraphicsServices 0x33e76d1c 0x33e72000 + 19740 36 UIKit 0x3591d574 0x358d3000 + 304500 37 UIKit 0x3591a550 0x358d3000 + 292176 38 My Game 0x000030a4 0x1000 + 8356 39 My Game 0x00003010 0x1000 + 8208 Thread 1: 0 libSystem.B.dylib 0x35d8f974 0x35d5a000 + 219508 1 libSystem.B.dylib 0x35e5e2fc 0x35d5a000 + 1065724 2 libSystem.B.dylib 0x35e5dd68 0x35d5a000 + 1064296 3 libSystem.B.dylib 0x35e5d788 0x35d5a000 + 1062792 4 libSystem.B.dylib 0x35de6970 0x35d5a000 + 575856 5 libSystem.B.dylib 0x35ddd2fc 0x35d5a000 + 537340 Thread 2: 0 libSystem.B.dylib 0x35d5b3b0 0x35d5a000 + 5040 1 libSystem.B.dylib 0x35d5d894 0x35d5a000 + 14484 2 CoreFoundation 0x37521f7c 0x374f9000 + 167804 3 CoreFoundation 0x37521780 0x374f9000 + 165760 4 CoreFoundation 0x37521504 0x374f9000 + 165124 5 CoreFoundation 0x37521412 0x374f9000 + 164882 6 WebCore 0x3318bd14 0x33070000 + 1162516 7 libSystem.B.dylib 0x35de5b44 0x35d5a000 + 572228 8 libSystem.B.dylib 0x35dd77a4 0x35d5a000 + 513956 Thread 0 crashed with ARM Thread State: r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x3e74f308 r4: 0x00000006 r5: 0x00238cfc r6: 0x00238ff0 r7: 0x2fdfdd2c r8: 0x3eba21b8 r9: 0x0000000a r10: 0x3eba21bc r11: 0x0022fb00 ip: 0x00000025 sp: 0x2fdfdd2c lr: 0x35de3ac5 pc: 0x35de3ad0 cpsr: 0x000a0010 Binary Images: 0x1000 - 0xebfff +My Gamearmv6 <15bbbead83159dac341a987c660d2b28> /var/mobile/Applications/2968E5FB-96DD-443D-B386-D68F08E9345E/My Game.app/My Game 0x1f8000 - 0x1f9fff dns.so armv6 <88b569311cca4a9593b2d670051860d1> /usr/lib/info/dns.so 0x2fe00000 - 0x2fe29fff dyld armv6 <617f6daf4103547c47a8407a2e0b90de> /usr/lib/dyld 0x30229000 - 0x30268fff MBXGLEngine armv6 <9d60c44b1ddc55387a0cb77f90660b37> /System/Library/Frameworks/OpenGLES.framework/MBXGLEngine.bundle/MBXGLEngine 0x3027c000 - 0x3027efff IOMobileFramebuffer armv6 <f42bbbf67195a7b98d67ad021bba4784> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer 0x3027f000 - 0x3038dfff CFNetwork armv6 <d6eeee83216ee9c553134f069f37cbc2> /System/Library/Frameworks/CFNetwork.framework/CFNetwork 0x303ef000 - 0x303f4fff CaptiveNetwork armv6 <f41df4b358b77b29ff85e0eaea88ee1d> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork 0x303f5000 - 0x30444fff Security armv6 <cf625b4dc7ea928891313444ef64a7cb> /System/Library/Frameworks/Security.framework/Security 0x30445000 - 0x3055cfff libicucore.A.dylib armv6 <8968ff3f62d7780bb1bd75026a7628d0> /usr/lib/libicucore.A.dylib 0x3055d000 - 0x30561fff ApplePushService armv6 <0560b630d26e261e205fc58942e1885c> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService 0x3059d000 - 0x305a8fff MobileWiFi armv6 <c7532e63e083a1dd2a0ef7352b85749d> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi 0x305aa000 - 0x30612fff libvDSP.dylib armv6 <9d264733fc675943c082bd3b9b567b59> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib 0x30613000 - 0x3064dfff MobileCoreServices armv6 <beb473ce80390554bb4af21554522286> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices 0x3065c000 - 0x3066efff libbsm.0.dylib armv6 <51e7bb18da9afa44a33e54e42fbd0707> /usr/lib/libbsm.0.dylib 0x3066f000 - 0x306c6fff CoreMedia armv6 <cd5e9398c161f129146931e888e1c92e> /System/Library/Frameworks/CoreMedia.framework/CoreMedia 0x306f0000 - 0x306fefff libz.1.dylib armv6 <84592e96bae1a661374b0f9a5d03a3a0> /usr/lib/libz.1.dylib 0x306ff000 - 0x30729fff PrintKit armv6 <74f9710fa01a33b5bb04c4aeabd6be7d> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit 0x3072e000 - 0x307d0fff AVFoundation armv6 <da9d96f32791f51ecb439c5eaeeff59a> /System/Library/Frameworks/AVFoundation.framework/AVFoundation 0x307d7000 - 0x3082afff IOKit armv6 <20da5e822f21a8d0a7c5b3e149330efd> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 0x30831000 - 0x3083bfff AccountSettings armv6 <eca67ab04f724e1fa7c6406c88e75433> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings 0x30a04000 - 0x30aa3fff ProofReader armv6 <2734920b62f174c17aeeb15f371615ef> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader 0x30ad6000 - 0x30b1afff AddressBook armv6 <1f30c3370dad27331a491ba4b190813c> /System/Library/Frameworks/AddressBook.framework/AddressBook 0x30b3d000 - 0x30b9cfff CoreAudio armv6 <ccc4bace0d6eca79a32ed84d566f72e9> /System/Library/Frameworks/CoreAudio.framework/CoreAudio 0x32d7d000 - 0x32d89fff libkxld.dylib armv6 <f74f359de7bbe3ccdc37fa6f332aebf4> /usr/lib/system/libkxld.dylib 0x32d95000 - 0x32e5cfff libobjc.A.dylib armv6 <429841269f8bcecd4ba3264a8725dad6> /usr/lib/libobjc.A.dylib 0x32e5d000 - 0x32ecdfff libsqlite3.dylib armv6 <87b9bb47687902d9120d03d1da9eb9fc> /usr/lib/libsqlite3.dylib 0x32f0c000 - 0x32f1ffff libmis.dylib armv6 <dba9c086b49bd9540930ff27211570d6> /usr/lib/libmis.dylib 0x33055000 - 0x33061fff SpringBoardServices armv6 <fd0c472436b3306f5b56118c93c8a423> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices 0x33062000 - 0x3306ffff MobileBluetooth armv6 <2b68516e1321011a4efbee2947d463c6> /System/Library/PrivateFrameworks/MobileBluetooth.framework/MobileBluetooth 0x33070000 - 0x338bffff WebCore armv6 <aa3b6827f051da7a3494c9bee4ebe290> /System/Library/PrivateFrameworks/WebCore.framework/WebCore 0x33ab4000 - 0x33ab4fff Accelerate armv6 <cdde24a7ad004b2b2e600cd4f3ac5eb7> /System/Library/Frameworks/Accelerate.framework/Accelerate 0x33bbc000 - 0x33c0afff CoreText armv6 <16c9582fdffb598178287c6ce9fd6897> /System/Library/Frameworks/CoreText.framework/CoreText 0x33c16000 - 0x33d73fff libGLProgrammability.dylib armv6 <aec6b54ffd532bb607aab4acbab679b6> /System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib 0x33d85000 - 0x33e71fff QuartzCore armv6 <77cd91ff21fe6c58c309f2c82eb95ca5> /System/Library/Frameworks/QuartzCore.framework/QuartzCore 0x33e72000 - 0x33e81fff GraphicsServices armv6 <af20aba0ec96e7b7c42bb55ac763c784> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 0x33ead000 - 0x33f6efff ImageIO armv6 <0c1b6f466667ff345f2399d8142a9d10> /System/Library/Frameworks/ImageIO.framework/ImageIO 0x33f78000 - 0x33f79fff CoreSurface armv6 <5e290514380c626e9b0f9f9985b9dc7a> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface 0x34137000 - 0x34156fff EAP8021X armv6 <fa56845b5396c3ebb368c2368331643c> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X 0x343a0000 - 0x343bffff Bom armv6 <f41bef81e23e2bff59155e5ce46762d3> /System/Library/PrivateFrameworks/Bom.framework/Bom 0x343c0000 - 0x344bdfff JavaScriptCore armv6 <3547c92c1efc0522b087e7f10eba7728> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore 0x344be000 - 0x34500fff ManagedConfiguration armv6 <397723a33c19c3487d304d69580acbfc> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration 0x34b52000 - 0x34f1ffff libLAPACK.dylib armv6 <0eb734c91165416224b98c943ff6476b> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib 0x34f20000 - 0x35014fff libiconv.2.dylib armv6 <01916d6784f4de8f3746978faae9c5fa> /usr/lib/libiconv.2.dylib 0x35015000 - 0x35022fff CoreVideo armv6 <7b100fd5fdf98db1cd0f0649e7f6f316> /System/Library/Frameworks/CoreVideo.framework/CoreVideo 0x35151000 - 0x35272fff Foundation armv6 <6bdeb19a1fcb93e2930dadb50416f881> /System/Library/Frameworks/Foundation.framework/Foundation 0x3529b000 - 0x352a6fff libbz2.1.0.dylib armv6 <6aa8a4ed0906a495d059ace9125f525d> /usr/lib/libbz2.1.0.dylib 0x352dc000 - 0x35342fff libBLAS.dylib armv6 <11a3677a08175a30df1b3d66d7e0951a> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib 0x35406000 - 0x35406fff vecLib armv6 <8f914b3e8a581d49fb21d2c0ff75be03> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib 0x35407000 - 0x3540afff MobileInstallation armv6 <456ed7fe6dd9fcd8e78df425085b1452> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation 0x354be000 - 0x354dcfff OpenAL armv6 <e86dc71ad650db8a13e4785e9c35a4b9> /System/Library/Frameworks/OpenAL.framework/OpenAL 0x35541000 - 0x35547fff MBX2D armv6 <fad4955cab36e0179df6f8f27d365b8f> /System/Library/PrivateFrameworks/MBX2D.framework/MBX2D 0x35815000 - 0x3581afff AssetsLibraryServices armv6 <224b3cf992a01814f91481244e3213eb> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices 0x3581b000 - 0x35877fff libGLImage.dylib armv6 <7c1049f20c4e64591c09d3ac00c7d3ab> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib 0x358bc000 - 0x358c3fff liblockdown.dylib armv6 <f470dea180ddf23886df75eb256d3888> /usr/lib/liblockdown.dylib 0x358cc000 - 0x358cffff libgcc_s.1.dylib armv6 <bed95ed187350ce27d22ed241ef892ea> /usr/lib/libgcc_s.1.dylib 0x358d3000 - 0x35d4ffff UIKit armv6 <14ec6c926b8bda71b73136f6e1a6ac1b> /System/Library/Frameworks/UIKit.framework/UIKit 0x35d5a000 - 0x35e98fff libSystem.B.dylib armv6 <70571c1e697e2ae7f7a9b1a499453bb6> /usr/lib/libSystem.B.dylib 0x35f7e000 - 0x35fc2fff VideoToolbox armv6 <101dbbcd34cc3231a8be3fd6392556aa> /System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox 0x35fdb000 - 0x36162fff CoreGraphics armv6 <9a1d72fa9549d83abc1e735ba37a4dc2> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics 0x36179000 - 0x36255fff WebKit armv6 <83da207070be989ba81dba3a83d5206a> /System/Library/PrivateFrameworks/WebKit.framework/WebKit 0x36269000 - 0x36278fff OpenGLES armv6 <37eda5ddcff210dd321157da35a87a5e> /System/Library/Frameworks/OpenGLES.framework/OpenGLES 0x363f3000 - 0x363f9fff MobileKeyBag armv6 <2d83bf6a43bab972d77a1a6e0f3b03d2> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag 0x365db000 - 0x365f9fff libresolv.9.dylib armv6 <9c94634beea733e754dc115737b6e63c> /usr/lib/libresolv.9.dylib 0x36746000 - 0x3683cfff libxml2.2.dylib armv6 <9c44d05cc67f1ebabd795903e581724e> /usr/lib/libxml2.2.dylib 0x3683e000 - 0x36888fff libCGFreetype.A.dylib armv6 <cfc94cfa17958f2f94c9eff208a7dace> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib 0x3694c000 - 0x3694ffff libAccessibility.dylib armv6 <74e0f77cc276a9412be268c795fdcbca> /usr/lib/libAccessibility.dylib 0x36955000 - 0x36a1ffff Celestial armv6 <11172a6ee53bdf067548cd4496bc5fe0> /System/Library/PrivateFrameworks/Celestial.framework/Celestial 0x36a2d000 - 0x36a30fff CrashReporterSupport armv6 <00bc60f690e6328b64e7a7b718edf45a> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport 0x36a31000 - 0x36a74fff CoreTelephony armv6 <cabbce0fa7630065dc7e7d3ca3bc616c> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony 0x36c1c000 - 0x36c26fff AggregateDictionary armv6 <f7429444c955e4f13c6761d20032ab52> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary 0x36c2b000 - 0x36de1fff AudioToolbox armv6 <bb65e8ed531fe5923eb8ac00a7c0d87d> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox 0x36de2000 - 0x36e16fff AppSupport armv6 <783e14db9585fd063c0c2a755cd121b6> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport 0x36e17000 - 0x36e2dfff PersistentConnection armv6 <006723906b8ac250c1681a1821fbe94d> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection 0x37141000 - 0x37184fff SystemConfiguration armv6 <207f362e707871e74a292cfd1ea7893d> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration 0x372aa000 - 0x37477fff MediaToolbox armv6 <21ceabd0e5de17ad4e883c85fcd34d51> /System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox 0x37478000 - 0x3747dfff IOSurface armv6 <ffd66ca04dfe7d382d6961f0df3839ff> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface 0x3748d000 - 0x374f8fff libstdc++.6.dylib armv6 <eccd1d7183e73587b2c0aa5755a19c39> /usr/lib/libstdc++.6.dylib 0x374f9000 - 0x375e4fff CoreFoundation armv6 <ab0eac0ddd5b4ae1bf8541116e3c0bd1> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x3760a000 - 0x3760bfff DataMigration armv6 <d2de7c0db77278484236669c2cdccabb> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration 0x37731000 - 0x37736fff libGFXShared.dylib armv6 <bd1c480607cc286288db1ca1aec64180> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib 0x377f6000 - 0x37817fff libRIP.A.dylib armv6 <22c6da37f3adf325f99c3a0494e04c02> /System/Library/Frameworks/CoreGraphics.fram

    Read the article

  • When memory is actually freeded?

    - by zhyk
    Hello all. I'm trying to understand memory management stuff in Objective-C. If I see the memory usage listed by Activity Monitor, it looks like memory is not being freed (I mean column rsize). But in "Object Allocations" everything looks fine. Here is my simple code: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSInteger i, k=10000; while (k>0) { NSMutableArray *array = [[NSMutableArray alloc]init]; for (i=0;i<1000*k; i++) { NSString *srtring = [[NSString alloc] initWithString:@"string...."]; [array addObject:srtring]; [srtring release]; srtring = nil; } [array release]; array = nil; k-=500; } [NSThread sleepForTimeInterval:5]; [pool release]; return 0; } As for retain and release it's cool, everything is balanced. But rsize decreases only after quitting from this little program. Is it possible to "clean" memory somehow before quitting?

    Read the article

  • How to get application context path in spring-ws?

    - by Dhaliwal
    I am using Spring-WS to create a webservice. In my project, I have created a Helper class to reads sample response and request xml file which are located in my /src/main/resource folder. When I am unit-testing my webservice application 'locally', I use the System.getProperty("user.dir") to get the application context folder. The following is a method that I created in the Helper class to help me retrieve the file that I am interested in my resource folder. public static File getFileFromResources(String filename) { System.out.println("Getting file from resource folder"); File request = null; String curDir = System.getProperty("user.dir"); String contextpath = "C:\\src\\main\\resources\\"; request = new File(curDir + contextpath + filename); return request; } However, after 'publishing' the compiled WAR file to the ../webapps folder to the Apache Tomcat directory, I realise that System.getProperty("user.dir") no longer returns my application context path. Instead, it is returning the Apache Tomcat root directory as shown C:\Program Files\Apache Software Foundation\Tomcat 6.0\src\main\resources\SampleClientFile I cant seem to find any information about getting the root folder of my webservice. I have seen examples on Spring web application where I can retrieve the context path by using the following : request.getSession().getServletContext().getContextPath() But in this case, I am using a Spring web application where there is a servlet context in the request. But the Spring-WS, my entry point is an endpoint. How can I get the context path of my webservice application. I am expecting a context path of something like C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\clientWebService\WEB-INF\classes Could someone suggest a way to achieve this?

    Read the article

  • php automatically commented with apache

    - by clement
    We have installed apache 2.2, and activeperl to run bugzilla, all that on a Windows Server 2003. Here We want to install PHP on the server to install a wiki. I followed those steps: tutorial to install PHP and enable it from Apache. After all those steps, I restart couples of times, and When I try a simple phpinfo() on PHP, the whole PHP code is commented: < ! - - ?php phpinfo(); ? - - Now, the httpd.conf was already edited for the PERL and it can be those edits that make the mistake. Here is the whole httpd.conf file: ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2" Listen 6969 LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule php5_module "c:/php/php5apache2_2.dll" LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule cgi_module modules/mod_cgi.so LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so LoadModule include_module modules/mod_include.so LoadModule isapi_module modules/mod_isapi.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule setenvif_module modules/mod_setenvif.so User daemon Group daemon ServerAdmin [email protected] DocumentRoot C:/bugzilla-4.4.2/ Options FollowSymLinks AllowOverride None Order deny,allow Deny from all Options Indexes FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all ScriptInterpreterSource Registry-Strict DirectoryIndex index.html index.html.var index.cgi index.php Order allow,deny Deny from all Satisfy All ErrorLog "logs/error.log" LogLevel warn LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/" AllowOverride None Options None Order allow,deny Allow from all DefaultType text/plain AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddHandler cgi-script .cgi AddType application/x-httpd-php .php SSLRandomSeed startup builtin SSLRandomSeed connect builtin PHPIniDir "c:/php"

    Read the article

  • NSDrawer delegate pointing to deallocated object?

    - by Isaac
    A user has sent in a crash report with the stack trace listed below (I have not been able to reproduce the crash myself, but every other crash this user has reported has been a valid bug, even when I couldn't reproduce the effect). The application is a reference-counted Objective-C/Cocoa app. If I am interpreting it correctly, the crash is caused by attempting to send a drawerDidOpen: message to a deallocated object. The only object that should be receiving drawerDidOpen: is the drawer's delegate object (nowhere does any object register to receive drawer notifications), and the drawer's delegate object is instantiated via the XIB/NIB file, wired to the delegate outlet of the drawer, and not referenced anywhere else. Given that, how can I protect against the delegate getting dealloc'd before the drawer notification? Or, alternately, what have I misinterpreted that might be causing the crash? Crash log/stack trace: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: objc_msgSend() selector name: drawerDidOpen: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8272011c objc_msgSend + 40 1 com.apple.Foundation 0x00007fff87d0786e _nsnote_callback + 167 2 com.apple.CoreFoundation 0x00007fff831bcaea __CFXNotificationPost + 954 3 com.apple.CoreFoundation 0x00007fff831a9098 _CFXNotificationPostNotification + 200 4 com.apple.Foundation 0x00007fff87cfe7d8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 101 5 com.apple.AppKit 0x00007fff8512e944 _NSDrawerObserverCallBack + 840 6 com.apple.CoreFoundation 0x00007fff831d40d7 __CFRunLoopDoObservers + 519 7 com.apple.CoreFoundation 0x00007fff831af8c4 CFRunLoopRunSpecific + 548 8 com.apple.HIToolbox 0x00007fff839b8ada RunCurrentEventLoopInMode + 333 9 com.apple.HIToolbox 0x00007fff839b883d ReceiveNextEventCommon + 148 10 com.apple.HIToolbox 0x00007fff839b8798 BlockUntilNextEventMatchingListInMode + 59 11 com.apple.AppKit 0x00007fff84de8a2a _DPSNextEvent + 708 12 com.apple.AppKit 0x00007fff84de8379 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155 13 com.apple.AppKit 0x00007fff84dae05b -[NSApplication run] + 395 14 com.apple.AppKit 0x00007fff84da6d7c NSApplicationMain + 364 15 (my app's identifier) 0x0000000100001188 start + 52

    Read the article

  • Reverse geocode coordinates to street address and setting as subtitle in annotation?

    - by Krismutt
    Hey everybody! Basically I wanna reverse geocode my coordinates for my annotation and show the address as the subtitle for the annotation. I just cant figure out how to do it... savePosition.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> #import <MapKit/MKReverseGeocoder.h> #import <AddressBook/AddressBook.h> @interface savePosition : NSObject <MKAnnotation, MKReverseGeocoderDelegate> { CLLocationCoordinate2D coordinate; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; -(id)initWithCoordinate:(CLLocationCoordinate2D) coordinate; - (NSString *)subtitle; - (NSString *)title; @end savePosition.m @synthesize coordinate; -(NSString *)subtitle{ return [NSString stringWithFormat:@"%f", streetAddress]; } -(NSString *)title{ return @"Saved position"; } -(id)initWithCoordinate:(CLLocationCoordinate2D) coor{ coordinate=coor; NSLog(@"%f,%f",coor.latitude,coor.longitude); return self; MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate]; geocoder.delegate = self; [geocoder start]; } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{ NSString *streetAddress = [NSString stringWithFormat:@"%@", [placemark.addressDictionary objectForKey:kABPersonAddressStreetKey]]; } @end any ideas?? Thanks in advance!

    Read the article

  • Why does this program take up so much memory?

    - by Adrian
    I am learning Objective-C. I am trying to release all of the memory that I use. So, I wrote a program to test if I am doing it right: #import <Foundation/Foundation.h> #define DEFAULT_NAME @"Unknown" @interface Person : NSObject { NSString *name; } @property (copy) NSString * name; @end @implementation Person @synthesize name; - (void) dealloc { [name release]; [super dealloc]; } - (id) init { if (self = [super init]) { name = DEFAULT_NAME; } return self; } @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Person *person = [[Person alloc] init]; NSString *str; int i; for (i = 0; i < 1e9; i++) { str = [NSString stringWithCString: "Name" encoding: NSUTF8StringEncoding]; person.name = str; [str release]; } [person release]; [pool drain]; return 0; } I am using a mac with snow leopard. To test how much memory this is using, I open Activity Monitor at the same time that it is running. After a couple of seconds, it is using gigabytes of memory. What can I do to make it not use so much?

    Read the article

  • Why is the compiler caching my "random" and NULLED variables?

    - by alex gray
    I am confounded by the fact that even using different programs (on the same machine) to run /compile, and after nilling the vaues (before and after) the function.. that NO MATTER WHAT.. I'll keep getting the SAME "random" numbers… each and every time I run it. I swear this is NOT how it's supposed to work.. I'm going to illustrate as simply as is possible… #import <Foundation/Foundation.h> int main(int argc, char *argv[]) { int rPrimitive = 0; rPrimitive = 1 + rand() % 50; NSNumber *rObject = nil; rObject = [NSNumber numberWithInt:rand() % 10]; NSLog(@"%i %@", rPrimitive, rObject); rPrimitive = 0; rObject = nil; NSLog(@"%i %@", rPrimitive, rObject); return 0; } Run it in TextMate: i686-apple-darwin11-llvm-gcc-4.2 8 9 0 (null) Run it in CodeRunner: i686-apple-darwin11-llvm-gcc-4.2 8 9 0 (null) Run it a million times, if you'd like. You can gues what it will always be. Why does this happen? Why oh why is this "how it is"?

    Read the article

  • How to use custom UITableViewCell from Interface Builder?

    - by Krumelur
    I want to be able to design my own UITableViewCell in IB. But I keep getting a null ref exception when trying to access the label I defined in IB. Here's what I'm doing: In Interface Builder: I removed the "View" and added a UITableViewCell instead. Changed the class of the UITableViewCell to "TestCellView". Added a UILabel to the cell. Added an outlet "oLblText" to TestCellView and connected the UILabel to it. Changed the identifier of the class to "TestCellView". Implement TestCellView.xib.cs public partial class TestCellView : UITableViewCell { public TestCellView(string sKey) : base(UITableViewCellStyle.Default, sKey) { } public TestCellView(IntPtr oHandle) : base(oHandle) { } public string TestText { get { return this.oLblText.Text; } set { // HERE I get the null ref exception! this.oLblText.Text = value; } } } ** The TestCellView.designer.cs** [MonoTouch.Foundation.Register("TestCellView")] public partial class TestCellView { private MonoTouch.UIKit.UILabel __mt_oLblText; #pragma warning disable 0169 [MonoTouch.Foundation.Connect("oLblText")] private MonoTouch.UIKit.UILabel oLblText { get { this.__mt_oLblText = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("oLblText"))); return this.__mt_oLblText; } set { this.__mt_oLblText = value; this.SetNativeField("oLblText", value); } } } In my table's source: public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { TestCellView oCell = (TestCellView)tableView.DequeueReusableCell("myCell"); if(oCell == null) { // I suppose this is wrong but how to do it correctly? // this == my UITableViewSource. NSBundle.MainBundle.LoadNib("TestCellView", this, null); oCell = new TestCellView("myCell"); } oCell.TestText = "Cell " + indexPath.Row; return oCell; } Please note that I do NOT want a solution that involves a UIViewController for every cell. I have seen a couple of examples on the web doing this. I just think it is total overkill. What am I doing wrong?

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >