Nativescript iOS Build/Run on Device Fails

2.1k Views Asked by At

I am having an issue building an running an app (particularly the HelloWorld template) on my iPhone through Nativescript. The Android build/run works flawless but getting the iOS counterpart to work has been a nightmare. For background, I am running the latest version of macOS (High Sierra) and the latest version of XCode. The issue is whenever I try building, I am told that XCode 8 requires a teamid (mind you I am using XCode 9 also). The build then crashes and produces an output listed below. I have seen people discuss manually inserting their teamid into the config file, however since I am not enrolled in the developer program I do not have a teamid. Do I have to enroll in the $99 program just to run something on my device? I do have a dev certificate set up in XCode and I tried doing the temporary provisioning profiles in Sidekick but regardless I still get this error. Furthermore, some people suggest opening the actual app XCode project, however I cant even open it as it immediately crashes XCode once clicked upon. What could be the issue here? Why isn't it as simple as the Android build/run process? Also, the emulator doesnt work as well, with it giving its own host of error messages, yet this wouldnt be a good idea to begin with due to my computer's hardware making the emulator extremely slow and unrealiable. Therefore running on my device, like Android, would work the best. The output is below:

jslarosmbp:HelloWorld Js$ tns run ios
Searching for devices...
Preparing project...
Project successfully prepared (iOS)
Building project...
Xcode 8 requires a team id to be specified when building for device.
You can specify the team id by setting the DEVELOPMENT_TEAM setting in build.xcconfig file located in App_Resources folder of your app, or by using the --teamId option when calling run, debug or livesync commands.
Xcode build...
2017-12-18 11:56:20.660 xcodebuild[3263:131976] [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: 0x7fbf626a0a70>
Method:   -_xc_setValue:forMacroName:conditionSet:errorHandler:
Thread:   <NSThread: 0x7fbf60d175e0>{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   __82+[IDEContainer _retainedContainerAtFilePath:fileDataType:workspace:options:error:]_block_invoke (in IDEFoundation)
 50   +[IDEContainer _retainedContainerAtFilePath:fileDataType:workspace:options:error:] (in IDEFoundation)
 51   +[IDEContainer retainedWrappedWorkspaceForContainerAtFilePath:fileDataType:error:] (in IDEFoundation)
 52   -[Xcode3CommandLineBuildTool _resolveInputOptionsWithTimingSection:] (in Xcode3Core)
 53   -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
 54  0x000000010621c2af (in xcodebuild)
 55   start (in libdyld.dylib)
Unable to apply changes on device: 5d3917082e289838a5b920f9c2xxf5c1f7804149. Error is: Command xcodebuild failed with exit code null.

Anything that could be detailedly suggested would be greatly appreciated. Thank you!

1

There are 1 best solutions below

2
On

You can still test on real device without having to enroll in the paid membership but you will still need to provide your development id

See the following links:

https://developer.apple.com/support/compare-memberships/

http://www.idownloadblog.com/2015/12/24/how-to-create-a-free-apple-developer-account-xcode/

Once your provisioning profiles are set you can see them with

tns run ios --provision

and them deploy your applicaiton on iOS device with

tns run ios --provision <your-provision-id>

In cases where the above does not work, you can open the produced iOS project (xcodeproj file in platforms/ios/build) and then directly set your development ID via XCode.