question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to use --provision option to build or run iOS apps

See original GitHub issue

Environment

OSX: 10.15.4

Output of tns doctor: ✔ Getting NativeScript components versions information… ✔ Component nativescript has 6.7.4 version and is up to date. ✔ Component tns-core-modules has 6.5.2 version and is up to date. ✔ Component tns-ios has 6.5.1 version and is up to date. ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly. ✔ The Python ‘six’ package is found. ✔ Xcode version 11.5.0 satisfies minimum required version 10.

Not interested in Android in this project, so Android bits are not configured

Describe the bug

I am unable to run or build the app.

I can build the prepared app using XCode (once I fix the signing configuration, another potential issue with prepare command)

When trying to list available provisioning profiles:

tns <run|build|provision> ios --provision

Results in the not so friendly:

Expected “"” or [^‘"’] but “'” found.

When I run the command with the logging level increased:

tns <run|build|provision> ios --provision --log trace

I get the more useful:

...
Current CLI version:  6.7.4
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/j/Projects/visionlab/sad-dev/hooks' ]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/j/Projects/visionlab/sad-dev/hooks' ]
AfterHookName for command resolveCommand is after-resolveCommand
Validate options for platform: iOS
SyntaxError: Expected "\"" or [^'"'] but "'" found.
    at peg$buildStructuredError (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js:314:12)
    at Object.peg$parse [as parse] (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js:999:11)
    at Object.read (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/index.ts:243:43)
    at IOSProvisionService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:80:55)
...

I tried to checkout what was going on above but it’s complicated. I think it fails when trying to parse provisioning profiles.

Sadly the same error occurs when I try to supply a provisioning profile:

tns run ios --provision <UUID or Name>

Same thing happens on a newly created app.

Trying to run the app with no provisioning profile supplied in the command line fails with a signing error (regardless of the PROVISIONING_PROFILE or DEVELOPMENT_TEAM) being set in app/App_Resources/build.xcconfig but that’s probably another issue.

To Reproduce

tns create sad-dev
cd sad-dev
tns run ios --provision

Expected behavior

A list of provisioning profiles

Additional context

I am running on Catalina. All seemed to work before I updated the OS. But sadly other stuff changed as well: NS version, etc…

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jpakulskicommented, Jun 10, 2020

Hi Nathanael,

I followed Your suggestions. Also, updated Node.

But unfortunately this resulted in the same error:

xcodeproj is installed and is configured properly.
CocoaPods are installed.
CocoaPods update is not required.
CocoaPods are configured properly.
Your current CocoaPods version is newer than 1.0.0.
Python installed and configured correctly.
The Python 'six' package is found.
Xcode version 11.5.0 satisfies minimum required version 10.
Project dir from hooksArgs is: /Users/j/Projects/visionlab/happy-dev.
Hooks directories: [ '/Users/j/Projects/visionlab/happy-dev/hooks' ]
AfterHookName for command checkEnvironment is after-checkEnvironment
Validate options for platform: iOS
SyntaxError: Expected "\"" or [^'"'] but "'" found.
    at peg$buildStructuredError (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js:314:12)
    at Object.peg$parse [as parse] (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js:999:11)
    at Object.read (/usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/index.ts:245:32)
    at IOSProvisionService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:80:55)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:3:12)
    at IOSProvisionService.queryProvisioningProfilesAndDevices (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:79:16)
    at IOSProvisionService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:35:37)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:3:12)
    at IOSProvisionService.listProvisions (/usr/local/lib/node_modules/nativescript/lib/services/ios-provision-service.js:34:16)
    at IOSProjectService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/ios-project-service.js:107:49)
happy-dev % chrome /usr/local/lib/node_modules/nativescript/node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js

I then took a better look at the code. It’s failing when validating my certificates.

Our company has an apostrophe in its name. And sadly this results in the name of my certificate having a single quote in it. This is obviously valid from Apple’s perspective, but the function peg$parse (in /node_modules/ios-mobileprovision-finder/parsers/security-find-identity.js) used to parse the certificate does not permit a single quote in the name.

It seems like there is a bug with the peg$parse function. (or pesky apostrophes in English 😃

The fix, that seems to work, is to simply remove the single quote restriction from the parser regex (if this is a bug).

That part of the regex [^‘"’] is sort of strange anyway because the single quote is repeated twice in the “not” char set, or I’m miss-understanding how that parser works.

0reactions
facetiouscommented, Sep 15, 2022

@jpakulski You’re absolutely right about that regex. It’s likely a result of a (very early development cycle) search-and-replace that changed the other " marks on that same line into '"'. It was likely never caught because it would require an apostrophe to be present within your name in order to fail, and the developers testing it may not have encountered that.

Changing it to Name = '"' literal:$[^"]* '"' { return literal; } should resolve the issue. (as verified using https://pegjs.org/online)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Run App on Device | Apple Developer Forums
I recently moved an app from the original developer account to a new account. After doing this, I am no longer able to...
Read more >
ios - Can't Obtain Apple Provisioning through Paid Apple ...
Launch Xcode then choose Xcode / Preferences, then choose Accounts. Make that page happy. That's probably going to involve downloading a code ...
Read more >
Publishing Xamarin.iOS apps to the App Store - Microsoft Learn
This document describes how to configure, build, and publish a Xamarin.iOS application for distribution in the App Store.
Read more >
What is a provisioning profile & code signing in iOS?
Unlike Android, you can't install any app on an iOS device. It has to be signed by Apple first. However, when you're developing...
Read more >
build_ios_app - fastlane docs
Run fastlane gym init to create a new configuration file. ... Optional: If gym can't automatically detect the provisioning profiles to use, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found