Search Results

Search found 51 results on 3 pages for 'nslocalizedstring'.

Page 1/3 | 1 2 3  | Next Page >

  • Unit Testing iPhone Code That Uses NSLocalizedString

    - by Jay Haase
    I have an iPhone iOS4.1 application that uses localized strings. I have just started building unit tests using the SenTestingKit. I have been able to successfully test many different types of values. I am unable to correctly test any of my code that uses NSLocalizedString calls, because when the code runs in my LogicTests target, all of my NSLocalizedString calls only return the string key. I have added my Localizable.strings file to the LogicTests target. My question is: How must I configure my LogicTests target so that calls to NSLocalizedString will return the localized string and not the string key.

    Read the article

  • Managing several hundred occurrences of NSLocalizedString

    - by Gordon Hughes
    My application has several hundred points of localisation, some of which can be reused many times. To prevent from hunting and pecking through code to find occurrences of a particular NSLocalizedString, I create a macro for each in a header file using the #define preprocessor directive. For example: #define kLocFirstString NSLocalizedString(@"Default Text", @"Comment") #define kLocSecondString NSLocalizedString(@"More Text", @"Another comment") ... When I want to refer to a particular string, I do so by its macro name. This method has been working nicely for me, but I'm concerned that such blatant abuse of #define is frowned upon. From the standpoint of "correctness", should I just inline each NSLocalizedString with the code, or is there another method (extern NSString *aString; perhaps?) that I can use to collect the declarations in one place?

    Read the article

  • Have different fallback language than the keys used in NSLocalizedString(@"Text aka. key",@"Descript

    - by Allisone
    I use everywhere NSLocalizedString(@"Text in deutsch",@"das Textfeld Text in deutsch") I have two Localizable.strings files. One for german and one for english. What I realized now is. If you have a german iPhone, you get the german text, if you have your iPhone set to english you get the english text. But if you have lets say french, then you would get the german text, too because I use german as the keys, right ? Is there a way to set english as fallback language instead of the german one used everywhere in my code ? (I have so many occurences of NSLocalizedString that it would be a pain to change the keys now everywhere (in code, in Localized.string.en and in Localized.string.de))

    Read the article

  • Changing the language for NSLocalizedString() in run time

    - by user117758
    I have an iPhone application which has a button to change display language in run time. I have looked at NSLocalizedString() which will return the appropriate strings according to system preference. What are my options rather than hard coding all the display strings and return according to user language selection in run time? Any pointers will be much appreciated.

    Read the article

  • Comparing against NSLocalizedString safe?

    - by George
    Hi, Sometimes I need to compare interface elements to other objects. At the moment I'm doing it by comparing their titles against a localized string. Am I right that I better compare my objects against IBOutlets? Tags are out of the question because I'm using NSMenu.

    Read the article

  • iPhone Internationalization. What is the simplest workflow for me?

    - by dugla
    Hello, I am wising up and getting my internationalization act together. Right off the bat I am a bit swamped by all the docs Apple provides so I was wondering of someone could sketch a workflow for my situation. Before I begin, I browsed some Apple example code and noticed this NIB file - MainWindow.xib - in the Resources folder: This clearly has something to do with internationalization/localization. Could someone please explain how this is created and where in the workflow it happens? My app is fundamentally an imaging app with a few labels that I currently programmatically internationalize using NSLocalizedString(...). If I set all my labels programmatically and wrap all my strings with NSLocalizedString(...) can I completely ignore the NIB issues? Thanks in advance, Doug

    Read the article

  • Advanced Localization with Omission of Arguments in Xcode

    - by coneybeare
    I have this formatted string that I am having a translator work on. ENGLISH "Check out the %1$@ %2$@ in %3$@: %4$@" = "Check out the %1$@ %2$@ in %3$@: %4$@" GERMAN TRANSLATION "Check out the %1$@ %2$@ in %3$@: %4$@" = "Hör Dir mal %2$@ in %3$@ an: %4$@"; These are passed to a [NSString stringWithFormat:] call: ////////////////////////////////////// // Share Over Twitter NSString *frmt = NSLocalizedString(@"Check out the %1$@ %2$@ in %3$@: %4$@", @"The default tweet for sharing sounds. Use %1$@ for where the sound type (Sound, mix, playlist) will be, %2$@ for where the audio name will be, %3$@ for the app name, and %3$@ for where the sound link will be."); NSString *urlString = [NSString stringWithFormat:@"sounds/%@", SoundSoundID(audio)]; NSString *url = ([audio audioType] == UAAudioTypeSound ? UrlFor(urlString) : APP_SHORTLINK); NSString *msg = [NSString stringWithFormat: frmt, [[Audio titleForAudioType:[audio audioType]] lowercaseString], [NSString stringWithFormat:@"\"%@\"", AudioName(audio)], APP_NAME, url]; NSString *applink = [NSString stringWithFormat:@" %@", APP_SHORTLINK]; if (msg.length <= (140 - applink.length)) { msg = [msg stringByAppendingString:applink]; } returnString = msg; With the desired and actual outcome of: ENGLISH desired: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app" actual: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app" GERMAN desired: "Hör Dir mal "This Sound Name" in My App Name an: link_to_sound link_to_app" actual: "Hör Dir mal sound in "This Sound Name" an: My App Name link_to_app" THE PROBLEM The problem is that I was under the assumption that by using numbered variable in the NSLocalizedString, I could do things like this, where the %1$@ variable is completely omitted. If you notice, the German translation of the format string does not use the first argument (%1$@) at all but it ("sound") still appears in the output string. What am I doing wrong?

    Read the article

  • Multi-line strings in objective-c localized strings file

    - by chrispix
    I have a template for an email that I've put in a localized strings file, and I'm loading the string with the NSLocalizedString macro. I'd rather not make each line its own string with a unique key. In Objective-C, I can create a human-readable multiline string like so: NSString *email = @"Hello %@,\n" "\n" "Check out %@.\n" "\n" "Sincerely,\n" "\n" "%@"; I tried to put that in a .strings file with: "email" = "Hello %@,\n" "\n" "Check out %@.\n" "\n" "Sincerely,\n" "\n" "%@"; But I get the following error at build time: CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary. email-template.strings: Unexpected character " at line 1 Command /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings failed with exit code 1 I can concatenate it all together like this: "email" = "Hello %@,\n\nCheck out %@.\n\nSincerely,\n\n%@"; But that will be a mess to maintain, particularly as the email gets longer. Is there a way to do this in a localized strings file? I've already tried adding backslashes at the end of each line, to no avail.

    Read the article

  • Issues dismissing keyboard conditionally

    - by Chris
    I have an app that has a username and password field. I want to validate the input before the the user is allowed to stop editing the field. To do that, I'm using the textFieldShouldEndEditing delegate method. If the input doesn't validate I display a UIAlertView. This approach works as advertised - the user cannot leave the field if the input doesn't validate. To have the done button on the keyboard dismiss the keyboard, I call resignFirstResponder on the textfield. The issue I have is the alert is being called twice. How do I keep the alert from showing twice? edit for clarification What is happening is that the alert appears, then another alert appears. I then have to dismiss both windows to fix the input. Here is the textFieldShouldEndEditing method -(BOOL)textFieldShouldEndEditing:(UITextField *)textField { NSLog(@"function called %@",textField); if([textField.text length] == 0) { return YES; } if(textField == userName) { if([self userNameValidated:textField.text]) { NSLog(@"name validated"); NSString *tempDonerName = [[NSString alloc] initWithString:(@"%@",userName.text)]; //[[NSUserDefaults standardUserDefaults] setObject:tempDonerName forKey:@"name"]; [tempDonerName release]; return YES; } else { NSLog(@"name did not validate"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid Username",@"Invalid Username title") message:NSLocalizedString(@"Please make sure there are no apostrophes,spaces in the username, and that the username is less than 12 characters",@"Invalid username message") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",@"OK Text") otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } } else if (textField == userPin) { if([self userPinValidated:textField.text]) { NSLog(@"pin validated"); //NSString *tempDonerPin = [[NSString alloc] initWithString:(@"%@",userPin.text)]; //[[NSUserDefaults standardUserDefaults] setObject:tempDonerPin forKey:@"pin"]; //[tempDonerPin release]; return YES; } else { NSLog(@"pin did not validate"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid Password",@"Invalid Pin title") message:NSLocalizedString(@"Please make sure there are no apostrophes in the password",@"Invalid password message") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",@"OK Text") otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } }else { NSLog(@"code validate - shouldn't get called"); return YES; } }

    Read the article

  • Does -localizedDescription of NSError return the actual localized string, or does it return a key fo

    - by mystify
    Must I do something like this? NSString *errorDescription = [error localizedDescription]; NSString *errorInfoStr = NSLocalizedString(errorDescription, nil); Or do I use NSLocalizedString already when populating the userInfo dictionary with the NSLocalizedDescriptionKey key and value? So the value for that is not actually a key for NSLocalizedString, but it is the actual localized string ready to show up on screen?

    Read the article

  • How To Load Images into Custom UITableViewCell?

    - by Clifton Burt
    This problem is simple, but crucial and urgent. Here's what needs to be done: load 66px x 66px images into the table cells in the MainViewController table. each TableCell has a unique image. But how? Would we use cell.image?... cell.image = [UIImage imageNamed:@"image.png"]; If so, where? Is an if/else statement required? Help? Here's the project code, hosted on Google Code, for easy and quick reference... http://www.google.com/codesearch/p?hl=en#Fcn2OtVUXnY/trunk/apple-sample-code/NavBar/NavBar/MyCustomCell.m&q=MyCustomCell%20lang:objectivec To load each cell's labels, MainViewController uses an NSDictionary and NSLocalizedString like so... //cell one menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"PageOneTitle", @""), kTitleKey, NSLocalizedString(@"PageOneExplain", @""), kExplainKey, nil]]; //cell two menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"PageOneTitle", @""), kTitleKey, NSLocalizedString(@"PageOneExplain", @""), kExplainKey, nil]]; ... // this is where MainViewController loads the cell content - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MyCustomCell *cell = (MyCustomCell*)[tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; if (cell == nil) { cell = [[[MyCustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease]; } ... // MyCustomCell.m adds the subviews - (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier { self = [super initWithFrame:aRect reuseIdentifier:identifier]; if (self) { // you can do this here specifically or at the table level for all cells self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // Create label views to contain the various pieces of text that make up the cell. // Add these as subviews. nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; // layoutSubViews will decide the final frame nameLabel.backgroundColor = [UIColor clearColor]; nameLabel.opaque = NO; nameLabel.textColor = [UIColor blackColor]; nameLabel.highlightedTextColor = [UIColor whiteColor]; nameLabel.font = [UIFont boldSystemFontOfSize:18]; [self.contentView addSubview:nameLabel]; explainLabel = [[UILabel alloc] initWithFrame:CGRectZero]; // layoutSubViews will decide the final frame explainLabel.backgroundColor = [UIColor clearColor]; explainLabel.opaque = NO; explainLabel.textColor = [UIColor grayColor]; explainLabel.highlightedTextColor = [UIColor whiteColor]; explainLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:explainLabel]; //added to mark where the thumbnail image should go imageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 66, 66)]; [self.contentView addSubview:imageView]; } return self; } HELP?

    Read the article

  • UIActionSheet cancel button strange behaviour

    - by nevan
    I have a UIBarButtonItem opening an action sheet to offer users choices about what to do. Everything works as expected unless I try to click on the "Cancel" button. The target of the button appears to have moved up from where it should be. I can only activate it by clicking somewhere in the middle of the "Cancel" and "Ok" buttons. I've tried at action sheets in other applications and they work fine, so it's not just my big thumb. The action sheet is opening in a UIViewController - (void)showOpenOptions { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Open link in external application?", @"Open in external application") delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") destructiveButtonTitle:NSLocalizedString(@"Open Link", @"Open Link") otherButtonTitles:nil]; [sheet showInView:self.view]; [sheet release]; }

    Read the article

  • A question related to back button

    - by user217572
    I'm doing code for state maintainance So what happens that ,my currnet view will be appear after pressing homme now in this view i want to add backbutton in normal condition i'm adding button like this, [self navigationItem].title = NSLocalizedString(@"login_title",@""); UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"back_button",@" ") style:UIBarButtonItemStylePlain target:self action:@selector(done)]; [self.navigationItem setHidesBackButton:YES animated:YES]; self.navigationItem.leftBarButtonItem = backItem; [backItem release];

    Read the article

  • UIImageWriteToSavedPhotosAlbum with malloc_error

    - by lbalves
    I have an NIB file with a button. When I click this button, the setWallpaper: selector is called. Everything works as expected (the image is saved), excepte by the error thrown by malloc. malloc: *** error for object 0x184d000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug I've set a breakpoint at malloc_error_break, but I don't understand anything from the debugger. I couldn't even find the object 0x184d000. Does anyone know why is this happening? I had also tried to retain the UIImage before sending it to UIImageWriteToSavedPhotosAlbum, but without success. My code is below: - (IBAction)setWallpaper:(id)sender { UIImage *image = [UIImage imageNamed:@"wallpaper_01.png"]; UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); } - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Galo!!!",@"Saved image message: title") message:NSLocalizedString(@"Now, check your \"saved photos\" group at \"photos\" app in your iPhone and select the actions menu > set as wallpaper.",@"Saved image message") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",@"OK Button") otherButtonTitles:nil]; [alertView show]; [alertView release]; }

    Read the article

  • MFMailComposeViewController hangs my app

    - by Neal L
    Hi, I am trying to add email functionality to my app. I can get the MFMailComposeViewController to display correctly and pre-populate its subject and body, but for some reason when the user clicks on the "Cancel" or "Send" buttons in the nav bar the app just hangs. I inserted a NSLog() statement into the first line of mailComposeController"didFinishWithResult:error and it doesn't even print that line out to the console. Does anybody have an idea what would cause the MFMailComposeViewController to hang like that? Here is my code from the header: #import "ManagedObjectEditor.h" #import <MessageUI/MessageUI.h> @interface MyManagedObjectEditor : ManagedObjectEditor <MFMailComposeViewControllerDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate> { } - (IBAction)emailObject; @end from the implementation file: if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init]; mailComposer.delegate = self; [mailComposer setSubject:NSLocalizedString(@"An email from me", @"An email from me")]; [mailComposer setMessageBody:emailString isHTML:YES]; [self presentModalViewController:mailComposer animated:YES]; [mailComposer release]; } [error release]; [emailString release]; and here is the code from the callback: #pragma mark - #pragma mark Mail Compose Delegate Methods - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { NSLog(@"in didFinishWithResult:"); switch (result) { case MFMailComposeResultCancelled: NSLog(@"cancelled"); break; case MFMailComposeResultSaved: NSLog(@"saved"); break; case MFMailComposeResultSent: NSLog(@"sent"); break; case MFMailComposeResultFailed: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error sending email!",@"Error sending email!") message:[error localizedDescription] delegate:nil cancelButtonTitle:NSLocalizedString(@"Bummer",@"Bummer") otherButtonTitles:nil]; [alert show]; [alert release]; break; } default: break; } [self dismissModalViewControllerAnimated:YES]; } Thanks!

    Read the article

  • NSURLConnection request seems to disappear into thin air

    - by ibergmark
    Hi Everybody! I'm having trouble with a NSURLConnection request. My app calls a routine called sayHello to identify a user's device. This code works fine for all devices I've tested it on, but for some devices the request just seems to disappear into thin air with no errors or popups on the device. One specific device that fails is an iPod Touch 2G running OS 3.1.3. The app start's fine and doesn't crash, and none of my error popup messages are displayed. I just can't understand why my server never receives the request since the call to initWithRequest returns a pointer. Any help is much appreciated. Thanks. Here's the relevant header info: @interface Globals : NSObject { UserItem *userData; NSURLConnection *urlConnection; NSString *imageCacheLocation; NSOperationQueue *opQueue; } Here's the implementation of sayHello: - (void)sayHello:(BOOL)updateVisits; { NSString *updString; if (updateVisits) updString = @"Y"; else updString = @"N"; NSDictionary *dataDict = [[NSDictionary alloc] initWithObjectsAndKeys: [[UIDevice currentDevice] uniqueIdentifier], @"id", kProgVersion, @"pv", @"1", @"pr", userData.tagID, @"tg", updString, @"uv", nil]; NSString *urlString = [[NSString alloc] initWithString:kHelloURL]; urlConnection = [self localPOST:dataDict toUrl:urlString delegate:self]; [dataDict release]; [urlString release]; } - (NSURLConnection *)localPOST:(NSDictionary *)dictionary toUrl:(NSString *)urlString delegate:(id)delegate { NSString *myBounds = [[NSString alloc] initWithString:@"0xKmYbOuNdArY"]; NSMutableData *myPostData = [[NSMutableData alloc] initWithCapacity:10]; NSArray *formKeys = [dictionary allKeys]; for (int i = 0; i < [formKeys count]; i++) { [myPostData appendData:[[NSString stringWithFormat:@"--%@\n", myBounds] dataUsingEncoding:NSUTF8StringEncoding]]; [myPostData appendData:[[NSString stringWithFormat: @"Content-Disposition: form-data; name=\"%@\"\n\n%@\n", [formKeys objectAtIndex:i], [dictionary valueForKey:[formKeys objectAtIndex:i]]] dataUsingEncoding:NSUTF8StringEncoding]]; } [myPostData appendData:[[NSString stringWithFormat:@"--%@--\n", myBounds] dataUsingEncoding:NSUTF8StringEncoding]]; NSURL *myURL = [[NSURL alloc] initWithString:urlString]; NSMutableURLRequest *myRequest = [[NSMutableURLRequest alloc] initWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; NSString *myContent = [[NSString alloc] initWithFormat: @"multipart/form-data; boundary=%@", myBounds]; [myRequest setValue:myContent forHTTPHeaderField:@"Content-Type"]; [myRequest setHTTPMethod:@"POST"]; [myRequest setHTTPBody:myPostData]; NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:myRequest delegate:delegate]; if (!connection) { [[Globals sharedGlobals] showAlertWithTitle: NSLocalizedString( @"Connection failed", @"alert title - connection failed") message: NSLocalizedString( @"Could not open a connection.", @"alert message - connection failed")]; } [myBounds release]; [myPostData release]; [myURL release]; [myRequest release]; [myContent release]; return connection; } - (void)handleNetworkError:(NSError *)error { if (networkErrorAlert) return; networkErrorAlert = YES; [[Globals sharedGlobals] showAlertWithTitle: NSLocalizedString( @"Network error", @"alert title - network error") message: [NSString stringWithFormat: NSLocalizedString( @"This app needs a network connection to function properly.", @"alert message - network error")] otherButtons:nil delegate:self]; } - (void) connectionDidFinishLoading:(NSURLConnection *)connection { [urlConnection release]; urlConnection = nil; } - (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [self handleNetworkError:error]; [urlConnection release]; urlConnection = nil; }

    Read the article

  • iOS localization inconsistency

    - by Joe Völker
    I'm localizing an iPhone app for the first time. I've put all my strings into a Localizable.strings file, accessing them via NSLocalizedString from within my code. Works fine. Next, I have a file called info.html that contains the flesh of a UIWebView that I use as an About box. I've put it in the language folders (en.lproj and de.lproj), and added them to my Resources in Xcode. Now, in Simulator, both the Strings, and the html file display in the appropriate language. However, on the device, the Strings appear localized while the html file remains untranslated. This is a strange inconsistency between Simulator and Device! Anybody know of a workaround? (...other than defying the localization system, and using NSLocalizedString to call de_info.html, en_info.html etc. by hand.)

    Read the article

  • how to set data into textfeild

    - by shishir.bobby
    hi all i have a table view containing some text. and an selecting a row, i hv to set text on another view's textfeild based on the selected index of row od table view. this is hoe it looks like -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { abc *abcController = [ [ abcController alloc] initWithNibName:@"abcController" bundle:[NSBundle mainBundle]]; [self.navigationController abcController animated:YES]; coffeeObj = [appdelegate.coffeeArray objectAtIndex:indexPath.row]; abcController.sender.text =[NSString stringWithFormat:@" to %@", coffeeObj.to]; abcController.mobileNumber.text = [NSString stringWithFormat:@" from %@", coffeeObj.from]; [abcController release]; } and this is how my textfeilds looks like, which is in table view if(indexPath.row == 0) textField.keyboardType = UIKeyboardTypeDefault; else textField.keyboardType = UIKeyboardTypePhonePad; textField.autocorrectionType = UITextAutocorrectionTypeNo; [cell.contentView addSubview:textField]; if(indexPath.row == 0) { self.sender = textField; cell.textLabel.text = NSLocalizedString(@"From :", @" "); NSLog(@"sender: %@", self.sender.text); } else { self.mobileNumber = textField; cell.textLabel.text = NSLocalizedString(@"To :" ,@" "); NSLog(@"mobile Number: %@", self.mobileNumber.text); } [textField release]; my problem is i am not abel to set text in these textfeilds from previous view..... plz let me knw where i am wrong..... w8ing for a quick reply.. regards shishir

    Read the article

  • Need help regarding internationalization of iPhone application

    - by Taufeeq Ahmed
    I have provided support for two languages, English and Chinese, in my iPhone application. I use string files for the languages using "key"-"value" pairs and my application displays the appropriate language using NSLocalizedString(@"Fund red not red?", @""). I get only Chinese text when I run the app in XCode. How can I switch to different languages in XCode (iPhone simulator)?

    Read the article

  • ASIHttpRequest problems. "unrecognized selector sent to instance"

    - by Paul Peelen
    Hi, I am experiencing problems using ASIHttpRequst. This is the error I get: 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890' 2010-04-11 20:47:08.176 citybikesPlus[5885:207] Stack: ( 33936475, 2546353417, 34318395, 33887862, 33740482, 126399, 445238, 33720545, 33717320, 40085013, 40085210, 3108783, 11168, 11022 ) And this is my code (Part of it): // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [image setImage:[UIImage imageNamed:@"bullet_rack.png"]]; BikeAnnotation *bike = [[annotationView annotation] retain]; bike._sub = @""; [super viewDidLoad]; NSString *newUrl = [[NSString alloc] initWithFormat:rackUrl, bike._id]; NSString *fetchUrl = [newUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [networkQueue cancelAllOperations]; [networkQueue setRequestDidFinishSelector:@selector(rackDone:)]; [networkQueue setRequestDidFailSelector:@selector(processFailed:)]; [networkQueue setDelegate:self]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:fetchUrl]] retain]; [request setDefaultResponseEncoding:NSUTF8StringEncoding]; [networkQueue addOperation:request]; [networkQueue go]; } - (void)rackDone:(ASIHTTPRequest *)request { NSString *resultSearch = [request responseString]; NSData *data = [resultSearch dataUsingEncoding:NSUTF8StringEncoding]; NSString *errorDesc = nil; NSPropertyListFormat format; NSDictionary * dict = (NSDictionary*)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc]; rackXmlResult* fileResult = [[[rackXmlResult alloc] initWithDictionary:dict] autorelease]; rackXmlSet *rackSet = [fileResult getRackResult]; NSString *subString = [[NSString alloc] initWithFormat:@"Cyklar tillgängligt: %@ -- Lediga platser: %@", rackSet._ready_bikes, rackSet._empty_locks]; [activity setHidden:YES]; [image setHidden:NO]; BikeAnnotation *bike = [annotationView annotation]; bike._sub = subString; } - (void) processFailed:(ASIHTTPRequest *)request { UIAlertView *errorView; NSError *error = [request error]; NSString *errorString = [error localizedDescription]; errorView = [[UIAlertView alloc] initWithTitle: NSLocalizedString(@"Network error", @"Network error") message: errorString delegate: self cancelButtonTitle: NSLocalizedString(@"Close", @"Network error") otherButtonTitles: nil]; [errorView show]; [errorView autorelease]; } The process is loaded as LeftCalloutView in the callout bubble when annotations are loaded in my mapview, so quite a lot (80 times or so). It is meant to retrieve a XML Plist from a server, parse it and use the data... but it dies at the rackDone: Does anybody have any ideas? Regards, Paul Peelen

    Read the article

  • Load a list of localized strings at once in IOS

    - by Victor Ronin
    I want to show a table with the list of strings which are localized. The straightforward method would be: a) Point data source to my ViewController b) Define an array c) Allocate the array in my ViewController and init (arrayWithObjects) it with the strings from localized resources (NSLocalizedString) d) Use this array in UITableViewDataSource delegated methods Mainly my concern is item b). The construction looks quite heavy and I wonder whether I can somehow specify and load whole list of localized string at once.

    Read the article

  • iPhone internationalization: falling back to a default language

    - by MihaiD
    Consider the following situation: We have two Localizable.string files, one in en.lproj and one in it.lproj When the user switches to English or Italian, the proper localized string is loaded using NSLocalizedString(@"keyword", nil) If one of the files is missing the keyword, the string is not retrieved Is there any way to make this macro load the string from a specific language if it's keyword is not found in the current locale's Localizable.string?

    Read the article

  • How to use a method with more than one parameters to create custom buttons

    - by iphonix
    I am repeating my codes few times to create custom buttons, I am trying to create a method and create all my required buttons just by called that method and using two parameters, btnTitle and btnAction. My Codes for the method -(void) addnewButton:(NSString *) btnTitle withAction:UIAction btnAction; { // Add a custom edit navigation button editButton = [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString((btnTitle), @"") style:UIBarButtonItemStyleBordered target:self action:@selector(btnAction)] autorelease]; self.navigationItem.rightBarButtonItem = editButton; } Now how shall I call this method to create a button?

    Read the article

  • handleOpenURL not called using a custom url schema in iPhone OS

    - by favo
    Hi, I have successfuly added my own url schemes to my App. The App correctly launches using the schemes. Now I want to handle the incoming data but the delegate is not called. It is an universal app and I have added the following function to both AppDelegates: - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { if (!url) { return NO; } NSString *URLString = [url absoluteString]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"test message", nil) message:URLString delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alert show]; [alert release]; return YES; } I am testing with a schema like: myapp://appalarm.com …and would expect to be appalarm.com in the URLString What is wrong with it? Thanks for your responses!

    Read the article

  • Localizing concatenated or dynamic strings

    - by SooDesuNe
    I'm familiar with using NSLocalizedString() to localize strings, but the problem I have today requires a little more finesse. My situation is like this: NSString *userName; //the users name, entered by the user. Does not need localized NSString *favoriteFood; //the users favorite food, also entered by user, and not needing localized NSString *summary = [NSString stringWithFormat:@"%@'s favorite food is %@", userName, favoriteFood]; This works fine for english, but not every language uses the same word ordering as English, for example, a word-by-word translation of the same sentance from Japanese into English would read: UserName's favorite food pizza is Not to mention that 's is doesn't make a possessive in every language. What techniques are available for localizing this type of concatenated sentence?

    Read the article

1 2 3  | Next Page >