2

We have a Swift project for an UIKit app that is using Storyboards. Everything was fine until I decided to lower the Minimum deployment target of the app to iOS 7. When building the app I hit an assert in the ibtool which is trying to compile the storyboard. The error goes like this:

2015-06-12 11:49:07.216 ibtoold[41058:6974134] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-7702/InterfaceBuilderKit/Connections/IBConnection.m:182
Details:  Source and destination must be unique
Object:   <IBCocoaTouchStoryboardPushSegue: 0x7fdea9bce8a0>
Method:   -setDestination:
Thread:   <NSThread: 0x7fdea2c07820>{number = 1, name = main}
Hints: None
Backtrace:
  0  0x00000001015e0147 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
  1  0x00000001015dfb9f _DVTAssertionHandler (in DVTFoundation)
  2  0x00000001015dfe8e _DVTAssertionFailureHandler (in DVTFoundation)
  3  0x00000001023ff472 -[IBConnection setDestination:] (in IDEInterfaceBuilderKit)
  4  0x00000001023fe5c9 +[IBConnection connectionWithSource:label:andDestination:] (in IDEInterfaceBuilderKit)
  5  0x00000001086aa798 (in IDEInterfaceBuilderCocoaTouchIntegration)
  6  0x0000000108704abb (in IDEInterfaceBuilderCocoaTouchIntegration)
  7  0x0000000102481472 -[IBDocument updateConnectionsAfterEnablingOrDisablingConfigurations] (in IDEInterfaceBuilderKit)
  8  0x0000000102482194 __35-[IBDocument disableConfigurations]_block_invoke (in IDEInterfaceBuilderKit)
  9  0x0000000102481beb -[IBDocument maintainCanvasCentersWhileTransformingCanvasPositions:] (in IDEInterfaceBuilderKit)
 10  0x000000010248209c -[IBDocument disableConfigurations] (in IDEInterfaceBuilderKit)
 11  0x000000010868852c (in IDEInterfaceBuilderCocoaTouchIntegration)
 12  0x0000000102497469 -[IBDocumentAutolayoutManager runBlockInNewArbitrationStackEntryWithBehavior:block:] (in IDEInterfaceBuilderKit)
 13  0x000000010247de2b -[IBDocument modifyViewsInAutolayoutSafeWayDuring:] (in IDEInterfaceBuilderKit)
 14  0x00000001086884e2 (in IDEInterfaceBuilderCocoaTouchIntegration)
 15  0x000000010865d1e5 (in IDEInterfaceBuilderCocoaTouchIntegration)
 16  0x000000010244628f -[IBDocument finishChangingTargetRuntimeInCompiledIntermediateDocument] (in IDEInterfaceBuilderKit)
 17  0x00000001024a5811 __85-[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:]_block_invoke (in IDEInterfaceBuilderKit)
 18  0x00000001024a55a9 -[IBDocumentCompiler invokeWithIntermediateDocument:] (in IDEInterfaceBuilderKit)
 19  0x00000001024a574d -[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:] (in IDEInterfaceBuilderKit)
 20  0x00000001026aa61c -[IBStoryboardDocumentCompiler compileWithOptions:error:] (in IDEInterfaceBuilderKit)
 21  0x00000001024a5937 +[IBDocumentCompiler compileContentsOfDocument:options:error:] (in IDEInterfaceBuilderKit)
 22  0x0000000102460550 __47-[IBDocument compiledPackageWithOptions:error:]_block_invoke (in IDEInterfaceBuilderKit)
 23  0x0000000102498ee5 -[IBDocumentAutolayoutManager assertIfArbitrationIsScheduledDuring:] (in IDEInterfaceBuilderKit)
 24  0x00000001024604a7 -[IBDocument compiledPackageWithOptions:error:] (in IDEInterfaceBuilderKit)
 25  0x00000001013e9f0a (in ibtoold)
 26  0x00000001013e6b40 (in ibtoold)
 27  0x00000001013e9370 (in ibtoold)
 28  0x00000001013ef233 (in ibtoold)
 29  0x00000001013ef7b0 (in ibtoold)
 30  0x00000001013ef683 (in ibtoold)
 31  0x00000001013de60a (in ibtoold)
 32  0x00000001013eee2c (in ibtoold)
 33  0x00000001013ee074 (in ibtoold)
 34  0x00007fff9289f5c9 start (in libdyld.dylib)
 35  0x0000000000000002
Command /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool failed with exit code 255

I checked all segues (and they are a lot) but I din't seem to see something wrong. Also when the Minimum deployment target is 8.x there is not a problem.

Dunbar
  • 401
  • 5
  • 9
  • Have you trued deleting **DerivedData**? It could be *just* a leftover. – Michal Jun 12 '15 at 09:21
  • Yes I deleted the DerivedData and no effect. – Dunbar Jun 12 '15 at 12:05
  • Hmm...could you post the structure of your segues? Screenshot of the Storyboard maybe? – Michal Jun 12 '15 at 12:06
  • The app is pretty complex and has more than 50 view controllers with a lot of segues. I wonder what this error means: Details: Source and destination must be unique Object: Method: -setDestination: Thread: {number = 1, name = main} Hints: None – Dunbar Jun 12 '15 at 12:54
  • My wild guess that you have segues with the same identifier, other than that, hard to tell... – Michal Jun 12 '15 at 13:00
  • Yes I have several segues with same identifiers but this error tells that source and destination must be unique so this means that the source view controller and the destination view controller of the segue must be unique but what does unique mean? – Dunbar Jun 12 '15 at 13:08
  • Maybe there is some ambiguity. If there is same identifier for more segues, then those segues are not unique. Unique as - the compiler is 100% sure that you mean **this specific** segue. Maybe there is a segue with the same name but to two different destinations. Then the compielr doesn't know which one to choose. Again, I'm only guessing, because I don't know your app. I would suggest that you probably should try making your segues have unique names (at least add numbers), to avoid *any* ambiguity. – Michal Jun 12 '15 at 13:13
  • I had segues that had the same destination and the same id's but after making their id's different I get the same error. Again the error description says that **Source and Destination must be Unique** whatever that means?!? – Dunbar Jun 15 '15 at 08:07

1 Answers1

0

NOTE - This all came about from manually adding a referencing outlet to a UI element. I shortly after found out that I did NOT need to do that, and isntead simply adding a TAG was all I needed, since I just wanted to be able to access the element programmatically to hide/show it (Can I get the element by Tag from iPhone SDK?).

Anyway...

Don't know if this necessarily applies to OP, but maybe it will help a googler:

I ran into this error when I was manually adding a referencing outlet in the storyboard by editing the .xib's XML directly, instead of using the interface builder.

The reason: I wanted to add a referencing outlet to a label I had. However, when I used "New Referencing Outlet" in the interface builder, the IBOutlet I wanted did not show up on the list. So, I took the "bash it with a hammer until it works" approach and decided to manually add the referencing outlet in the XML.

A referencing outlet looks like this: <outlet property="nameOfTheVar" destination="9CH-Ow-gWo" id="8CH-Ow-hWo"/>

The destination is the id of the UI element that this is an outlet for, and id is a unique id for the referencing outlet.

An <outlet> should be a child of a <connections> element (Make's sense, it is connecting my UI element to in IBOutlet in code). My <label> has a <connections> element, and so I added the outlet there. That is what caused my Source and destination must be unique error. I guess it doesn't like a outlet to be a child of the element it is an outlet for.

So, to fix the error I moved the <outlet> from the <connections> element that was a child of the actual UI element, to the <connections> element that was a child of the <viewController> of that view.

Here is the (highly abbreviated) XML:

<viewController>
    <layoutGuides />
    <view>
        <subviews>
            <label id="9CH-Ow-gWo">
                <connections>
                    <!-- dont put the outlet here -->
                </connections>
            </label>
        </subviews>
    </view>
    <connections>
        <!--put the outlet here! -->
        <outlet property="nameOfTheVar" destination="9CH-Ow-gWo" id="8CH-Ow-hWo"/>
    </connections>
</viewController>
Community
  • 1
  • 1
chiliNUT
  • 18,989
  • 14
  • 66
  • 106