EzDevInfo.com

xcode6 interview questions

Top xcode6 frequently asked interview questions

xCode 6 how to enable storyboard zoom?

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)

How to download Xcode 4 / 5 / 6 / 7 and get the DMG file?

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)

Advertisements

Simulator error FBSSystemServiceDomain code 4

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)

Screenshot for error

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)

Adaptive segue in storyboard Xcode 6. Is push deprecated?

Xcode 6 interface builder by default has new checkbox "use size classes". It makes views adaptive. enter image description here

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

instead old:

enter image description here

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)

enter image description here

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 enter image description here

UPDATE 2:

I seems to be only iOS 7, iOS 7.1 issue.


Source: (StackOverflow)

Ineligible Devices section appeared in Xcode 6.x.x

After installing Xcode 6 my devices moved to greyed-out section Ineligible Devices and I can't select them as deploy target:

enter image description here

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)

Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

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 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)

What's the difference between all the Selection Segues?

  • Show
  • Show Detail
  • Present Modally
  • Popover presentation
  • Custom

What is the difference between them? I couldn't find any documentation on it. There used to be some which I found in a Google search, but it's now gone: https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/articles-storyboard/StoryboardSegue.html


Source: (StackOverflow)

Xcode 6 iPhone Simulator Application Support location

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)

Cannot find executable for CFBundle CertUIFramework.axbundle

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)

Xcode 6 Storyboard the wrong size?

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!

View from the Storyboard Editor

Attributes Inspector

Size Inspector

Simulator Output


Source: (StackOverflow)

Xcode 6 - How to pick signing certificate/provisioning profile for Ad-Hoc distribution?

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:Exporting IPA 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)

How can Xcode 6 adaptive UIs be backwards-compatible with iOS 7 and iOS 6?

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)

Autoresizing issue of UICollectionViewCell contentView's frame in Storyboard prototype cell (Xcode 6, iOS 8 SDK) happens when running on iOS 7 only

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.

http://i.stack.imgur.com/uDNDY.png

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.

http://i.stack.imgur.com/lOZH9.png

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)

NSNotificationCenter addObserver in Swift

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)