xcode4 interview questions
Top xcode4 frequently asked interview questions
I must be missing something obvious, but I can't figure out how to rename my project in Xcode 4.
If I remember correctly Xcode 3 had a dedicated menu item for this but there's no such entry in Xcode 4.
Source: (StackOverflow)
I use Apple Reachability class from Apple Sample code
Reachability
in Xcode 4.2 and new Apple 3.0 compiler I get warning in this class that
+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
*declaration of 'struct sockaddr_in*' will not be visible outside of this function*
I am not good at classic C %) so I dont understand how I can fix this warning or may be I can ignore it at all.
Thx
Source: (StackOverflow)
I want to remove all existing SDK versions as well as Xcode 4.
Xcode 4 Guide says to do this:
sudo /Xcode4/Library/uninstall-devtools --mode=all
But I don't have Xcode4 at this location and the only place I see it is under /Developer/Applications
I've already run the uninstall-devtools that was previously found in /Developer/Applications
and then did a reinstall.
What else can I do to completely remove everything and start from scratch?
Source: (StackOverflow)
I'm confused about how to perform the following function in Xcode 4 to set the model to use after creating a versioned model.
Design > Data Model > Set Current Version
Source: (StackOverflow)
Archiving my project in Xcode is creating a multi-application bundle, instead of bundling my main target for release, which is what I want. Specifically, when I validate my archive in Organizer, it gives me the message:
"[projectname] does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application."
It sounds like there is some setting in the scheme that needs to be adjusted, but I can't figure out what's causing other targets to be included.
I'm using Xcode 4.0 by the way.
Source: (StackOverflow)
In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored.
Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code in that file.
How should I do that?
Source: (StackOverflow)
I've been looking all over Xcode for this, but I can't find any place that allows you to rename an existing scheme in Xcode 4. Is this even possible?
Source: (StackOverflow)
CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain. The codesign tool requires there only be one.
So I go to my keychain and delete it. But I get this error every time I restart Xcode 4 and some app is adding the expired old certificate back into keychain. Any ideas why and which app?
Source: (StackOverflow)
This just started happening that my iOS project is only showing "My Mac 64-bit" rather than the Simulator or my iPhone to build to. I have no idea why this is happening. I do not think that I have changed anything.

I have my project set to iOS 5 as the base SDK, but no matter what I do it seems to never show my any other options to build for. I have restarted Xcode a few times, and still no luck.
Why is the happening?
Xcode 4.2, Build 4D199
Source: (StackOverflow)
I can't find the good old "Add existing frameworks" option. How do I do this?
We're talking about Xcode 4 DP2 (in the context of iPhone development, as far as it matters...).
Source: (StackOverflow)
The app neither installs nor runs on my device. All provisioning profiles are up to date. I've already tried deleting and re-installing them.
The status bar shows that Xcode is building my project, then it says running my project on , then it says "finished running ." Throughout this entire period, the iPod screen stays black. The iPod is being detected in the Organizer and I don't see anything wrong with its configuration. Everything was working perfectly just a couple days ago with Xcode 3.
It doesn't work on the simulator, but it may be important to note that in the simulator it appears to get stuck on "Attaching to " and the simulator refuses to start.
Source: (StackOverflow)
This is driving me crazy! I just upgraded to XCode 4 and for some reason my app won't run in the simulator or iOS device. It was working perfectly in XCode 3, but all of a sudden now when I press run the program stops at "Attaching to...". There doesn't seem to be any other info to help with this problem either. Any ideas?
For summary you can try following things to tackle the issue:
- Restart the simulator.
- Make sure that you haven't included the Info.plist file in your Building Phases -> Copy Bundle Resources.
- Resources folder added to the project as a folder reference (the blue folder icon). That caused the trouble, after adding the folder as a group the problem went away.
Thanks.
Source: (StackOverflow)
On my Lion app, I have this data model:

The relationship subitems
inside Item
is ordered.
Xcode 4.1 (build 4B110) has created for me the file Item.h
, Item.m
, SubItem.h
and SubItem.h
.
Here is the content (autogenerated) of Item.h
:
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class SubItem;
@interface Item : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSOrderedSet *subitems;
@end
@interface Item (CoreDataGeneratedAccessors)
- (void)insertObject:(SubItem *)value inSubitemsAtIndex:(NSUInteger)idx;
- (void)removeObjectFromSubitemsAtIndex:(NSUInteger)idx;
- (void)insertSubitems:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
- (void)removeSubitemsAtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectInSubitemsAtIndex:(NSUInteger)idx withObject:(SubItem *)value;
- (void)replaceSubitemsAtIndexes:(NSIndexSet *)indexes withSubitems:(NSArray *)values;
- (void)addSubitemsObject:(SubItem *)value;
- (void)removeSubitemsObject:(SubItem *)value;
- (void)addSubitems:(NSOrderedSet *)values;
- (void)removeSubitems:(NSOrderedSet *)values;
@end
And here is the content (autogenerated) of Item.m
:
#import "Item.h"
#import "SubItem.h"
@implementation Item
@dynamic name;
@dynamic subitems;
@end
As you can see, the class Item
offers a method called addSubitemsObject:
. Unfortunately, when trying to use it in this way:
Item *item = [NSEntityDescription insertNewObjectForEntityForName:@"Item" inManagedObjectContext:self.managedObjectContext];
item.name = @"FirstItem";
SubItem *subItem = [NSEntityDescription insertNewObjectForEntityForName:@"SubItem" inManagedObjectContext:self.managedObjectContext];
[item addSubitemsObject:subItem];
this error appear:
2011-09-12 10:28:45.236 Test[2002:707] *** -[NSSet intersectsSet:]: set argument is not an NSSet
Can you help me?
Source: (StackOverflow)