EzDevInfo.com

xcode4 interview questions

Top xcode4 frequently asked interview questions

Renaming projects in Xcode 4

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)

Xcode 4.2 - declaration of '...' will not be visible outside of this function warning

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)

Advertisements

How to fully remove Xcode 4

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)

How do I set up NSZombieEnabled in Xcode 4?

How do I set up NSZombieEnabled and CFZombieLevel for my executable in Xcode 4?


Source: (StackOverflow)

Xcode 4, Core Data Model Version - Set Current Version

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)

How to Empty Caches and Clean All Targets Xcode 4

Jonathan suggest here: Xcode Includes .xib files that have been deleted! that cleaning all targets and empty the caches will fix the problem with Xcode including deleted .xib files but i cannot find a way to empty the cache in Xcode 4.

Anyone know's how to do that in Xcode 4?


Source: (StackOverflow)

Archiving project in Xcode incorrectly creates multi-application bundle

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 Xcode, how to suppress all warnings in specific source files?

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)

Is there a way to rename an Xcode 4 scheme?

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 appearing twice

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)

Xcode iOS project only shows "My Mac 64-bit" but not simulator or device

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.

enter image description here

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)

How to "add existing frameworks" in Xcode 4?

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)

Xcode 4 says "finished running " on the targeted device -- Nothing happens

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)

XCode 4 hangs at "Attaching to (app name)"

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:

  1. Restart the simulator.
  2. Make sure that you haven't included the Info.plist file in your Building Phases -> Copy Bundle Resources.
  3. 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)

Exception thrown in NSOrderedSet generated accessors

On my Lion app, I have this data model:

enter image description here

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)