xcode6 interview questions
Top xcode6 frequently asked interview questions
I've updated to xCode6 beta 3 and see that the [+ = -] buttons in the storyboard corner are gone. Is there a way for me to zoom in and out on view controllers within a storyboard in Xcode 6?
Source: (StackOverflow)
Where does the Mac App Store download the files to under Lion? I need the DMG file in order to repair something in my system, but how can I access that file?
Source: (StackOverflow)
I'm trying to run an app in the simulator but get this error message:
Unable to run app in Simulator
An error was encountered while running (Domain = FBSSystemServiceDomain, Code = 4)

I've not seen any previous references to this from googling around.
Its using XCode 6 Beta, the app is in Swift which links to a Obj-C static library. It runs fine on the device.
Any ideas?
Source: (StackOverflow)
Xcode 6 interface builder by default has new checkbox "use size classes". It makes views adaptive.

When I try to make segue between 2 views in my storyboard I have new options:

instead old:

Now we have "show" and "present modally" instead of "push" and "modal". The old options are marked as deprecated. I've chosen "show" option, because in segue settings it called "show (e.g. push)

But it doesn't make push. Segue animation looks like slide from the bottom (modal) and navigation bar disappears.
Question is: How can I make "show" work like push? Is it possible or should I use "push (deprecated)" instead? Where can I find any information about new types of segue? The only thing that I've found in iOS8 developer library is Storyboards Help You Design Your User Interface but there is no information about "show" segue.
UPDATE
I tried to create new project and "show" is really works like "push".
I think the issue in my project can be because I reuse navigation controller with code like this, but I don't know how to fix it.
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[dvc] animated: NO ];
[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
};
}
After that I try to push NewViewController after MainViewController

UPDATE 2:
I seems to be only iOS 7, iOS 7.1 issue.
Source: (StackOverflow)
After installing Xcode 6 my devices moved to greyed-out section Ineligible Devices
and I can't select them as deploy target:

Update:
This error occurs in all versions of Xcode 6.x.x
.
There are so many different reasons causing this problem
Check this solution list for more details.
Source: (StackOverflow)
I opened an existing iOS project with Xcode6 beta6, and Xcode lists the following warning for both Storyboard and Xib files:
Automatic Preferred Max Layout Width is not available on iOS versions
prior to 8.0
I tried addressing the warning by setting the width as explicit like below:

Yet this didn't resolve the warnings. How can they be removed?
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)
In Xcode 6, I have an app I'm using Core Data in, but there is no folder in Application Support for the iOS 8 iPhone Simulator. Where are my files and Core Data sqlite database being stored?
Source: (StackOverflow)
Just updated to Xcode 5 and this is the first error its throwing on the logger for all my apps. Can't seem to understand why this is happening.
2013-09-19 10:46:54.341 MyApp[1156:a0b] Cannot find executable
for CFBundle 0x8a7c7a0 </Applications/Xcode.app/Contents/Developer/Platforms/
iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/
System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
Edit (11-11-2013): To everyone reading, once I waiting for a solid working solution to accept and close. The highest voted answer works until you re-open the project only.
Edit (30-09-2014): I can see this has been sorted since XCode 6 has been released! Finally
Source: (StackOverflow)
Built a new project from scratch in Swift in Xcode 6 (Beta 1) and have seen some strange behaviour with Storyboards and the output that I am viewing.
I have built a simple interface (as shown below) - with properties of View Controller included.
When I run this in the simulator I would expect 'Hello, World' to be central in the user interface - however it seems that this 'Square' is simply being fit into the iPhone screen and thus the wrong view is being shown (see below).
My question is: has anyone else seen this behaviour and how did they fix it?
Thanks!




Source: (StackOverflow)
To distribute the app to our testers we use Xcode, which we do using the following process:
- Archive application
- Distribute for Ad-Hoc
- Choose provisioning profile
- Save the .ipa to a folder
But with Xcode 6, this workflow was changed a bit. I can still select the Ad-Hoc distribution option, but I cannot select the provisioning profile I want. This gives us no control over which signing certificate is used and the provisioning profile configuration (we use push notifications).
By default iPhone distribution
signing identity is used and some kind of XC Ad Hoc
provisioning profile is generated, which can be seen on image below:
If you click the arrow near provisioning profile, it opens the folder with provisioning profiles.
So my question is:
Is there any way in Xcode 6 to select the provisioning profile used with Ad Hoc distribution?
Thanks!
Source: (StackOverflow)
I just watched the WWDC video #216, "Building Adaptive UI with UIKit."
At about 45:10 Tony Ricciardi talks about changes to IB in Xcode 6 to support the new changes.
He says "You can deploy these documents backwards to older versions of iOS".
(where "These documents" presumably means XIBs and storyboards that have specific settings for different size classes.)
I'm not making this up. Go watch the WWDC video.
How is that possible? Trait collections and size classes are only defined in iOS 8. How can runtime behavior that's dependent on UI constructs that are new to iOS 8 work in previous iOS versions?
If it is possible it would be wonderful. You could build apps that will run on iOS 6, 7, and 8, and take advantage of the new flexible UI layout abilities that Apple has added to Xcode 6. I've created adaptive UI logic myself in code, and it's quite a bit of work.
Source: (StackOverflow)
NOTE:
Got another serious bug with UITableViewCell in Storyboard. FYI if you also Static Cell on Xcode 6: Static UITableViewCell subviews are resized incorrectly (was off the screen, over the right edge) on Xcode 6.1.1, iOS 8.1 SDK
Update 2:
Paste this code at the beginning of your cellForItem and things should be okay:
/** Xcode 6 on iOS 7 hot fix **/
cell.contentView.frame = cell.bounds;
cell.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
/** End of Xcode 6 on iOS 7 hot fix **/
Update 1: This problem still exists in the official Xcode 6.0.1 ! The best work around is like what KoCMoHaBTa suggested below by setting the frame in cellForItem of the cell (You have to subclass your cell though). It turned out that this is a incompatibility between iOS 8 SDK and iOS 7 (check ecotax's answer below quoted from Apple).
Original:
I'm using Xcode 6 Beta 3, iOS 8 SDK. Build Target iOS 7.0 using Swift. Please refer to my problem step by step with screenshots below.
I have a UICollectionView in Storyboard. 1 Prototype UICollectionViewCell which contains 1 label in the centre (no autoresizing rule). Purple background was to mark a contentView that is generated in runtime by the Cell I guess. That view will be resized properly base on my UICollectionViewLayoutDelegate eventually, but not on iOS 7. Notice that I'm using Xcode 6 and the problem only happens on iOS 7.
When I build the app on iOS 8. Everything is okay.
Note: Purple is the contentView, Blue is my UIButton with rounded corner.

However, on iOS 7, all the subViews inside the Cell suddenly shrink to the frame of (0,0,50,50) and never conforms to my Autoresizing rule anymore.

I assume this is a bug in iOS 8 SDK or Swift or maybe Xcode? I'm stuck with this for 2 days without any hope of resolving it. Your help is appreciated.
Thanks a lot guys!
Kien.
Source: (StackOverflow)
How do you add an observer in Swift to the default notification center? I'm trying to port this line of code that sends a notification when the battery level changes.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryLevelChanged:) name:UIDeviceBatteryLevelDidChangeNotification object:nil];
Source: (StackOverflow)