cocoa-touch,ios,nib,iboutletRelated issues-Collection of common programming errors


  • Peter Hosey
    iphone cocoa-touch mode silent
    I would like to stop my application playing a sound if the user has switched the iPhone to silent mode. Where can I read that the phone is in silent mode? Is there some flag I can query? I noticed that some applications ignore the silent mode and some not, while I would have expected all apps to respect that silent is silent !! Any hints or input would be greatly appreciated. Thanks Al

  • morgancodes
    objective-c cocoa cocoa-touch json
    In java-land, there are a handful of useful libraries which will convert json strings to objects of matching type. The json libraries I’ve seen for cocoa simply create nested NSDictionaries and NSArrays. Is there a tool out there which will go the extra step of reconstituting whatever object type I want? So, for example, if I have a class called “Unicorn”, with a property “maneColor”, and I have json that looks like this:{“maneColor”:”silver” }I can automatically instantiate a Unicorn object wit

  • Andrew Johnson
    objective-c cocoa-touch core-data
    When using CoreData, the following multi-column index predicate is very slow – it takes almost 2 seconds for 26,000 records. Please note both columns are indexed, and I am purposefully doing the query with > and <=, instead of beginswith, to make it fast:NSPredicate *predicate = [NSPredicate predicateWithFormat:@”airportNameUppercase >= %@ AND airportNameUppercase < %@ \OR cityUppercase >= %@ AND cityUppercase < %@ \upperText, upperTextIncremented,upperText, upperTextIncremented];

  • Rob Keniger
    iphone cocoa-touch keyboard decimal nsdecimalnumber
    iPhone/Objective-C/Cocoa newbie here. Based on a number of posts on stackoverflow, I have cobbled together an IBAction that I’m using in a basic iPhone calculator app that I’m building. The IBAction works with the numeric keypad to allow entry of decimal numbers without having to enter a decimal point. I am trying very hard to adhere to the “use NSDecimal when dealing with currency” adage although I am finding it difficult to do so like so many others who have posted questions. I am making stead

  • carexcer
    ios objective-c cocoa-touch admob chartboost
    so after a week of attempting to load chart boost to my non-arc iOS app in Xcode, I’m gonna start asking some really silly questions. my code in my appdelegate is: (void)applicationDidBecomeActive:(UIApplication *)application {[[CCDirector sharedDirector] resume];Chartboost *cb = [Chartboost sharedChartboost];cb.appId = @”530dd707f8975c182ae2c691″;cb.appSignature = @”0d8726e69c911a182b0cefac4eca36f692355725″;// Required for use of delegate methods. See “Advanced Topics” section below.cb.delegate

  • NathFur
    objective-c ios cocoa-touch
    Finally yesterday I’ve got my UISearchBar working properly. Suddenly now I am facing another issue.When I navigate through the views, the navigation bar moves to the right and the same navigation bar appears again -> same title and navigation button on the left. TableView stays unmoved.On the second click on navigation button, it yes, returns to the previous View.The annotation I am getting is: Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get cor

  • mvds

  • DGund
    iphone ios objective-c cocoa-touch
    In one of my views in a navigation controller, I have a method – (void) loadAlert that gets the content of a web page, parses it, and places the relevant content on a UITextView. The method call is located in the viewDidAppear: section of my view controller. It works fine when the view first loads and when the view appears at all when navigated to.I also want this data load to occur when the app returns from background. As many Stackoverflow posts and other sources indicated, I put my method

  • Echilon
    iphone cocoa-touch objective-c++ iso
    I have an NSMutableArray in my class containing Ingredient objects. I want to check whether the name property of any of the ingredients matches a string, but I can’t get the syntax quite right.I’m really missing Linq and predictates.-(BOOL) hasIngredient:(NSString *)ingredientName{for (Ingredient *ingredient in ingredients) {//if([ingredient isKindOfClass:[Ingredient class]]){if ([ingredient->name isEqualToString:ingredientName]) {return YES;}//}}return NO; }

  • Rob Keniger
    iphone objective-c cocoa-touch eventkit
    I have a strange problem with EKEventEditViewController when using it with custom timezones. It behaves differently in two situations:Situation 1 – works fine:Launch app Create EKEventEditViewController to add new event with startDate = [NSDate date] New event start is displayed correctly (current time) Change default timezone with [NSTimeZone setDefaultTimeZone:otherTimeZone] Create EKEventEditViewController to add new event with startDate = [NSDate date] New event start is displayed correctly

  • AviD
    mobile risk-management ios
    Being employed in the infosec field I would like to set a good example. However I also do not believe in sweating the small stuff and would like to maximize my productivity. My current workplace, while piloting byo devices, iPads etc does not yet have an enterprise iPad solution. I have a personal iPad that I would like to use to take minutes of meetings and to brainstorm via mindmaps. At previous places where this was not frowned upon, I have found it significantly better than writing on a phys

  • Jaydles
    ios ios-6 iphone-5 maps
    The initial release of Apple Maps is… challenged with regard to business listings, and lacks transit directions.But most of the other apps Tim Cook suggested in his apology fail to solve the problem: the straight-up GPS nav apps lack transit directions and have mediocre POI data, and the webapps are slow and lack many of the features of the native ones.What’s the best workaround until Google releases an iPhone native app (likely months) or Apple’s databases catch up (likely years)?

  • bneely
    iphone ios youtube
    Whenever I try and log into the native Youtube app on my iPhone, it reports ‘Authentication Failed” even though the details are 100% correct. Here’s what I’ve done so far:Youtube.com accepts my username and password on both the desktop and iPhone web app. I’ve reset my Youtube password I get the same results over 3G or wifi (tried multiple networks, incl. Apple Store), so it is not my carrier or ISP blocking Youtube. A friend logged in with his account and the iPhone accepted it, so it isn’t sp

  • Guy
    iphone objective-c ios image-processing
    I’m trying to combine two photos into one image (think a body with a hole in the face on top of a picture of a different person’s face). The top image has some semi-transparent pixels and some fully transparent pixels and I want to overlay it on top of a solid image.Here’s what I’m doing: I have a Context with the right size and I draw the bottom image on it, without any alpha (faceImage). On top of that I draw an image that has a transparent hole in it, with various levels of transparencies (co

  • danielpunkass
    ios objective-c osx cocoa automatic-ref-counting
    In Apple’s documentation about ARC, they make a point of spelling out a problematic scenario in which ARC will generate a boilerplate temporary variable behind the scenes. Search on “The compiler therefore rewrites”:https://developer.apple.com/library/mac/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.htmlThe gist of the warning seems to be that because the stack-based variable is “strong” and the by-reference parameter to the called method (performOperationWithError:) i

  • SaamJB
    iphone objective-c ios
    I have a UITableViewController that when a cell is pressed, I want the controller to pop itself, and then have the controller it pop’s to, push another view controller onto the stack.I am invoking this method because the popped-to viewController is the delegate of the tableViewControllerI am currently invoking this method with a delay on it, because otherwise, everything gets screwed up waiting for the animation to end. Doing it this way seems a bit hacky and seems to me like it would fail if so

  • Steven
    objective-c ios oauth
    I’ve been trying to get a basic OAuth interaction working without success. There are certainly similar questions already posed on SO, but most of them have no replies. I’m getting pretty desperate here, so I’m just going to start by posting my entire code:// OAuth parameters NSString *oauthNonce = [self genRandStringLength:20]; NSString *oauthSignatureMethod = [NSString stringWithFormat:@”HMAC-SHA1″]; time_t oauthTimeStamp = (time_t) [[NSDate date] timeIntervalSince1970];// generate OAuth signat

  • Robin van Dijke
    ios core-data memory
    I’m now stuck for about two weeks with a nasty Core Data problem. I read lots of blogpost, articles and SO questions/answers but I’m still not able to solve my problem.I ran lots of tests and was able to reduce the larger problem to a smaller one. It’s going to be a large explanation so keep with me!Problem – datamodelI have to got following datamodel:Object A has one-to-many relation with object B which has another one-to-many relation with object C. Because of Core Data recommendations I have

  • Nate
    ios uiwebview uiscrollview uikit
    The QuestionDoes anyone know of technical reasons for avoiding web views inside scroll views on iOS (assuming you’re willing to disable scrolling inside the web views themselves)?If you look at the Apple docs for UIWebView, they state:Important: You should not embed UIWebView or UITableView objects inUIScrollView objects. If you do so, unexpected behavior can resultbecause touch events for the two objects can be mixed up and wronglyhandled.My Educated GuessIt looks like maybe they’re warning you

  • rmaddy
    ios uitabbarcontroller
    This question already has an answer here:Proper way to exit iPhone application?19 answersI have a tab based app, which last tab button is “Exit” how can I quite iPhone App, on click of that last tab bar?

  • John Woods
    ios objective-c cocoa-touch nib
    I have noticed that when adding a viewController with interface builder and a nib,That I don’t have to call initWithNibName for it to pick up the associated nib, I can just call init!Any idea why?ie.This:NotificationManagementController *notificationView = [[NotificationManagementController alloc] initWithNibName:@”NotificationManagementController” bundle:nil andCurrentNotifications:nil];and This:NotificationManagementController *notificationView = [[NotificationManagementController alloc] init]

  • rmvz3
    cocoa interface xcode4 interface-builder nib
    I have a nib in my Mac app that includes a few image views. Theese images make me difficult to edit the controls layered behind them or even check their position. I know I can check the Hidden property and make them semitransparent but I’d prefer just hide them momentarily (from the IB, not in runtime) as I do when work in any design program.Is there any way to do this?. Am I missing something?.

  • user512530
    cocoa osx nib nsbundle
    I’m developing on an older Mac. I don’t have access to newer Macs running Xcode 3.1, but I want to make sure my sourcecode will work on them. It’s been pretty easy so far, all I have to do is ignore anything with “deprecated” next to its name, but the change from NIBs to XIBs has me kind of tripped up. The things I’ve read seemingly imply that XIBs get compiled into NIBs during a Release build, but maybe they don’t during a Debug build. What would this do in Xcode 3.1?#import <Cocoa/Cocoa.h&g

  • Marcel Hansemann
    objective-c cocoa nib nsdocument nsbundle
    I have a document-based Cocoa app. During runtime, I load an additional nib from the bundle by invoking [NSBundle loadNibNamed:@”inspectorNIB” owner:self] (where self is the NSDocument).Strangely enough, while loading the bundle succeeds, it invokes the NSDocument’s awakeFromNib method again, causing an unnecessary second initialisation. Is this expected behaviour? How can I suppress it?

  • milesmeow
    ios xcode nib
    I have a nib file for the full version of the app. Buttons in that view are connected to functions in the view’s controller. I have two schemes (full version and lite version). Each one shares many files but have their own graphics files, etc. I also have #ifdef directives to include code for the lite version of the app.I want to create another version of the nib file for the lite version because there will be slight differences in the view…color changes, an added info button, additional text,

  • Ben Lings
    cocoa-touch ios nib iboutlet
    I have more than 20 labels that I need to update at runtime, and I was wondering if it could be possible to access them without having to declare properties and outlets for all of them. I tried to assign a unique tag to each, and access them trhough the view in my view contoller, something like this:self.view.myLabel1.text = @”Some text”;But it did not work. Is there a way to accomplish this?Thanks

  • gerry3
    iphone objective-c performance nib xib
    I was wondering if there is a difference between using .xib files for GUI design and doing this programmatically.As it is a compiler I would assume that there is no relevant time lost.Am I wrong?

  • user244129
    ios internationalization icons nib
    I have 2 localized directories ca.lproj and es.lproj. Both own a nib MyNib.xib and an icon MyIcon.png. MyIcon.png is used in a custom button in the nib. Because MyIcon.png has a text in it, the actual image is different for each folder, with the text drawn in the correct language. I need each nib to embbed the correct icon.The problem is that if I open the nib in one lproj ( say the es.lproj ) and try to assign the icon to the button in IB, I can only see the icon that belong to the OTHER lproj

  • Robert Karl
    ios uitableview uitableviewcell nib
    Is it possible to delete rows from a UITableView at runtime when all of the sections and rows are defined statically in a nib?In the following storyboard scene, can I delete the “Addr 2” field at runtime? In this case I have not provided a data source to the UITableView.

  • Piero
    iphone ios uitableviewcell xib nib
    Hello i have two Custom UITableViewCell nib, and i give the option to the users to choose what type of nib choose in the setting, i initialize the custom view cell in this way:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @”MasterViewCell”;UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {[[NSBundle mainBundle] loadNibNamed:[[NSUserDefaults standardUser

  • Josh Caswell
    ios xcode interface-builder ibaction iboutlet
    I am using XCode 4.6.3 to try iOS “hello world” like applications. I am able to create actions for UI elements using CTRL+Drag. My question is, how does XCode track which method is associated with a certain element. There is no such indication in the ViewController.m.

  • Casebash
    objective-c iboutlet
    The code generator Accessorizer has an option to assign IBOutlets rather than retaining them. For example, compare these two generated lines:@property(nonatomic,retain)IBOutlet UIImageView *backgroundView; @property(nonatomic,assign)IBOutlet UIImageView *backgroundView;Why would I want to assign IBOutlets, while retaining all other properties?

  • zanona
    objective-c ios interface-builder iboutlet
    sorry If am I being too picky on this one but I am learning iOS programming now and I’ve seem some people who declare the IBOutlet like this:IBOutlet attached to property#import <UIKit/UIKit.h> #import “CustomCell.h”@interface CustomTableViewController : UITableViewController {CustomCell *customCell; } @property (nonatomic, retain) IBOutlet CustomCell *customCell; @endAnd some declaring like this:IBOutlet attached to the declaration inside the interface#import <UIKit/UIKit.h> #import

  • Ben Lings
    cocoa-touch ios nib iboutlet
    I have more than 20 labels that I need to update at runtime, and I was wondering if it could be possible to access them without having to declare properties and outlets for all of them. I tried to assign a unique tag to each, and access them trhough the view in my view contoller, something like this:self.view.myLabel1.text = @”Some text”;But it did not work. Is there a way to accomplish this?Thanks

  • Vincent Gable
    xcode interface-builder compiler-warnings xib iboutlet
    How can I have Xcode warn me if an IBOutlet of one of my objects is not hooked up to anything in a NIB?I can check that outlets are connected at runtime by adding assert(ofEveryOutlet); in awakeFromNib or viewDidLoad. But it’s not as useful, or reliable, as having the compiler do the checking for me.

  • ThinkingStiff
    objective-c xcode4 nsstring iboutlet
    I have a UIView extended class which has an extra NSString property. For convenience I’d like to somehow set that property in the designer, if possible.@property (nonatomic,retain) IBOutlet NSString* designerAccessibleString;The property will show up as an Outlet as expected. I connect it to an NSString Object that was added from the Objects Library (added as Plain Object, class changed to NSString). But I’m unable to edit the string through the designer Attributes Inspector… is there a way?I

  • pcperini
    xcode cocoa null iboutlet automatic-ref-counting
    So I’ve got an NSViewController (MyVC) set up like so://MyVC.h … @property (nonatomic, retain) IBOutlet NSTextField *input; …//MyVC.m … @synthesize input;- (id)init {self = [super initWithNibName: @”MyVC” bundle: [NSBundle mainBundle]];NSLog(@”%@”, input); //prints (null) alwaysreturn self; }- (void)loadView {[super loadView];NSLog(@”%@”, input); //still (null) } …//MyVC.xibCustom View [Referencing Outlet: File’s Owner.view]Text Field [Referencing Outlet: File’s Owner.inpu

  • Jsdodgers
    arrays uiswitch iboutlet iboutletcollection
    I’m using an IBOutletCollection of switches to set them disabled. After create the IBOutletCollection, I made a for cycle to set them disabled:for (arraySwitchCounter = 0; arraySwitchCounter < _switchCollection.count; arraySwitchCounter ++) {UISwitch * disabledSwitch = [ _switchCollection objectAtIndex: arraySwitchCounter ];[disabledSwitch setEnabled: NO]; }but it crash on startup, I think trouble is on second row but I don’t know what…how can I solve? Thank you!

  • user456584
    objective-c ios uibutton iboutlet
    Possible Duplicate:UIAlertView crashes when added to app I recently tried to delete a UIButton outlet called myButton, but I’m thinking I must have missed something because I now get the following error:this class is not key value coding-compliant for the key myButtonIf I grep the entire project, there are no remaining references to myButton, so I’m not sure how to fix the issue.How does one get rid of this exception?

  • Olotiar
    objective-c ios variables uilabel iboutlet
    I’m having trouble casting a string to exchange for an IBOutlet variable name in my code.I’m trying to reference an instance of an IBOutlet UILabel that was declared in the header file by programmatically creating the same variable name later on.However, when I cast an string to try & substitute for the IBOutlet UILabel variable name, the program crashes.Hopefully, the example below explains what’s happening & why needed. Sorry if the description is a little shaky – I’m a beginner.When

Web site is in building