I have setup a new nativescript app by running the following:-
tns create application --ng
When I attempt to launch the application using:-
tns run ios --emulator
I get the following error:-
Unable to apply changes on device: BC7714A3-A8B0-4CEC-A7A4-D54563CF04EE. Error is: Command xcodebuild failed with exit code null.
The full error is:-
Searching for devices...
Executing before-liveSync hook from /XXXXXX/Desktop/Bike/hooks/before-liveSync/nativescript-angular-sync.js
Skipping prepare.
Building project...
Xcode build...
2018-04-30 21:49:36.684 xcodebuild[1674:27197] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-13756/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/RuntimeSupport/MacroExpansion/XCMacroExpansionExtensions.mm:94
Details: Assertion failed: [value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSArray class]]
Object: <DVTMacroDefinitionTable: 0x7fab68c72bb0>
Method: -_xc_setValue:forMacroName:conditionSet:errorHandler:
Thread: <NSThread: 0x7fab68d176a0>{number = 1, name = main}
Hints:
Backtrace:
0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 _DVTAssertionFailureHandler (in DVTFoundation)
4 -[DVTMacroDefinitionTable(XCMacroExpansionExtensions) _xc_setValue:forMacroName:conditionSet:errorHandler:] (in DevToolsCore)
5 -[DVTMacroDefinitionTable(XCMacroExpansionExtensions) _xc_setValue:forMacroName:errorHandler:] (in DevToolsCore)
6 __108-[DVTMacroDefinitionTable(XCMacroExpansionExtensions) xc_setMacroNamesAndValuesFromDictionary:errorHandler:]_block_invoke (in DevToolsCore)
7 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] (in CoreFoundation)
8 -[DVTMacroDefinitionTable(XCMacroExpansionExtensions) xc_setMacroNamesAndValuesFromDictionary:errorHandler:] (in DevToolsCore)
9 +[DVTMacroDefinitionTable(XCProjectArchivingExtensions) xc_macroDefinitionTableFromDictionaryRepresentationForProjectArchiving:usingPropertyDefinitionsFromSpecificationDomain:] (in DevToolsCore)
10 -[PBXBuildStyle _setBuildSettings:] (in DevToolsCore)
11 -[PBXUnarchivingBinding readValueForObject:fromPListUnarchiver:] (in DevToolsCore)
12 -[PBXObject _unarchiveValuesForArchiveMask:fromPListUnarchiver:] (in DevToolsCore)
13 -[PBXObject readFromPListUnarchiver:] (in DevToolsCore)
14 -[PBXBuildStyle readFromPListUnarchiver:] (in DevToolsCore)
15 -[PBXPListUnarchiver _unarchiveObjectWithGlobalIDHexString:] (in DevToolsCore)
16 -[PBXPListUnarchiver _decodeMutableObjectArrayFromPListArray:] (in DevToolsCore)
17 -[PBXPListUnarchiver decodeMutableObjectArrayForKey:] (in DevToolsCore)
18 -[PBXUnarchivingBinding readValueForObject:fromPListUnarchiver:] (in DevToolsCore)
19 -[PBXObject _unarchiveValuesForArchiveMask:fromPListUnarchiver:] (in DevToolsCore)
20 -[PBXObject readFromPListUnarchiver:] (in DevToolsCore)
21 -[PBXPListUnarchiver _unarchiveObjectWithGlobalIDHexString:] (in DevToolsCore)
22 -[PBXPListUnarchiver decodeObjectForKey:] (in DevToolsCore)
23 -[PBXUnarchivingBinding readValueForObject:fromPListUnarchiver:] (in DevToolsCore)
24 -[PBXObject _unarchiveValuesForArchiveMask:fromPListUnarchiver:] (in DevToolsCore)
25 -[PBXObject readFromPListUnarchiver:] (in DevToolsCore)
26 -[PBXPListUnarchiver _unarchiveObjectWithGlobalIDHexString:] (in DevToolsCore)
27 -[PBXPListUnarchiver _decodeMutableObjectArrayFromPListArray:] (in DevToolsCore)
28 -[PBXPListUnarchiver decodeMutableObjectArrayForKey:] (in DevToolsCore)
29 -[PBXUnarchivingBinding readValueForObject:fromPListUnarchiver:] (in DevToolsCore)
30 -[PBXObject _unarchiveValuesForArchiveMask:fromPListUnarchiver:] (in DevToolsCore)
31 -[PBXObject readFromPListUnarchiver:] (in DevToolsCore)
32 -[PBXProject readFromPListUnarchiver:] (in DevToolsCore)
33 -[PBXPListUnarchiver _unarchiveObjectWithGlobalIDHexString:] (in DevToolsCore)
34 -[PBXPListUnarchiver decodeRootObject] (in DevToolsCore)
35 +[PBXProject projectWithFile:errorHandler:readOnly:] (in DevToolsCore)
36 -[Xcode3Project initWithFilePath:extension:workspace:options:error:] (in DevToolsCore)
37 __82+[IDEContainer _retainedContainerAtFilePath:fileDataType:workspace:options:error:]_block_invoke_2 (in IDEFoundation)
38 _dispatch_client_callout (in libdispatch.dylib)
39 _dispatch_queue_barrier_sync_invoke_and_complete (in libdispatch.dylib)
40 DVTDispatchBarrierSync (in DVTFoundation)
41 -[DVTDispatchLock performLockedBlock:] (in DVTFoundation)
42 __82+[IDEContainer _retainedContainerAtFilePath:fileDataType:workspace:options:error:]_block_invoke (in IDEFoundation)
43 __58-[DVTModelObjectGraph performBlockCoalescingModelChanges:]_block_invoke (in DVTFoundation)
44 -[DVTModelGraphTransactionScope performTransaction:] (in DVTFoundation)
45 -[DVTModelObjectGraph performBlockCoalescingModelChanges:] (in DVTFoundation)
46 +[IDEContainer _retainedContainerAtFilePath:fileDataType:workspace:options:error:] (in IDEFoundation)
47 +[IDEContainer retainedContainerAtFilePath:fileDataType:workspace:error:] (in IDEFoundation)
48 -[IDEWorkspace _configureWrappedWorkspaceWithError:] (in IDEFoundation)
49 -[IDEWorkspace _setContainerFilePath:upgradeToWorkspace:error:] (in IDEFoundation)
50 +[IDEContainer retainedWrappedWorkspaceForContainerAtFilePath:fileDataType:error:] (in IDEFoundation)
51 -[Xcode3CommandLineBuildTool _resolveInputOptionsWithTimingSection:] (in Xcode3Core)
52 -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
53 0x00000001007592af (in xcodebuild)
54 start (in libdyld.dylib)
Unable to apply changes on device: BC7714A3-A8B0-4CEC-A7A4-D54563CF04EE. Error is: Command xcodebuild failed with exit code null.
Executing after-watch hook from /XXXXXX/Desktop/Bike/hooks/after-watch/nativescript-dev-typescript.js
The application occasionally launches without an issue, but stops 95% of the time I get the error above.
Any help would be greatly appreciated.
If anybody else is having this issue you need to run:-
tns platform remove ios; tns platform add ios
in your terminal and this will fix the issue.