Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: "invalid memory address or nil pointer dereference" while searching for required Provisioning Profile #141

Open
klokie opened this issue Jul 8, 2021 · 10 comments

Comments

@klokie
Copy link

klokie commented Jul 8, 2021

Hi, codesigndoc runs for about 10 minutes, and then crashes while trying to find the required provisioning profiles. I've tried with all available profiles. Note that using XCode I am able to successfully deploy a signed app to Apple, but Bitrise is failing during the signing phase.

Thanks for any suggestions!

./install_wrap-xcode.sh
 => Creating a temporary directory for codesigndoc ...
 => Downloading version: 2.4.1
 => Downloading codesigndoc from (https://github.com/bitrise-io/codesigndoc/releases/download/2.4.1/codesigndoc-Darwin-x86_64) to (/var/folders/v7/2g6__xrd51q9rf55s7lhqdmr0000gn/T/codesigndocXXXXXX.y83sP13Q/codesigndoc) ...
################################################################################################################################################################################## 100.0%
 => Making it executable ...
 => codesigndoc version: 2.4.1
 => Running codesigndoc scan ...

Scan the directory for project files
You can specify the Xcode project/workscape file to scan with the --file flag.
Found one project file: myproject.xcworkspace.

🔦  Scanning Schemes ...
$ xcodebuild "-workspace" "/Users/myuser/Sites/myproject/ios/myproject.xcworkspace" "-list"

Select the Scheme you usually use in Xcode
Please select from the list:
¬
[51] : myproject
¬
(type in the option's number, then hit Enter) [1] : 51

Xcode (xcodebuild) version: Xcode 12.5.1 (Build version 12E507)


🔦  Running an Xcode Archive, to get all the required code signing settings...
$ xcodebuild "-workspace" "/Users/myuser/Sites/myproject/ios/myproject.xcworkspace" "-scheme" "myproject" "clean" "archive" "-archivePath" "/var/folders/v7/2g6__xrd51q9rf55s7lhqdmr0000gn/T/__codesigndoc__226660178/myproject.xcarchive"
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

💡  Saving xcodebuild output into file: /Users/myuser/Sites/myproject/codesigndoc_exports/xcodebuild-output.log


🔦  Analyzing the archive, to get export code signing settings...

Codesign settings used for archive:
development team: mycompany AB (B6V4GVD2QJ)
codesign identity: Apple Development: Firstname Lastname (2U7AUQMY83) [47004173766525610323866067055204663722]
provisioning profiles: iOS Team Provisioning Profile: com.mycompany.supply -> com.mycompany.supply
                       iOS Team Provisioning Profile: com.mycompany.supply.myproject-Notification-Service-Extension -> com.mycompany.supply.myproject-Notification-Service-Extension

Targets to sign:
- com.mycompany.supply with 0 capabilities
- com.mycompany.supply.myproject-Notification-Service-Extension with 0 capabilities

Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2

Codesign Indentity for app-store ipa export: Apple Distribution: mycompany AB (B6V4GVD2QJ) [1185290782025666350] - development team: mycompany AB

Select the Provisioning Profile to sign target with bundle ID: com.mycompany.supply
Please select from the list:
[1] : 20210618 (5a6be14c-8fbc-46d3-bc28-fd4e549b6ed7)
[2] : 20210622 (c7ac3c5e-fa2a-486d-a837-1a8978546072)
[3] : Bitrise iOS app-store - (com.mycompany.supply) (4649ed22-c4c1-4e1e-b8f9-d2c5a2130d3e)
[4] : iOS Team Store Provisioning Profile: com.mycompany.supply (b8926f44-529a-4153-ad2b-bb6428c2a345)
(type in the option's number, then hit Enter) [1] : 3

Select the Provisioning Profile to sign target with bundle ID: com.mycompany.supply.myproject-Notification-Service-Extension
Please select from the list:
[1] : 20210618-notification-service (81c29bd1-8d13-4cbf-9798-cfcc3849a518)
[2] : 20210622-myproject-Notification-Service-Extensi (9bdf8614-8d35-46b0-b0e2-f464f7b9ce3d)
[3] : Bitrise iOS app-store - (com.mycompany.supply.myproject-Notification-Service-Extension) (c279bbeb-3aa7-4210-8920-71b65ad9d7fd)
[4] : iOS Team Store Provisioning Profile: com.mycompany.supply.myproject-Notification-Service-Extension (f040097a-cbe0-4648-8ded-26da89030207)
(type in the option's number, then hit Enter) [1] : 3

Codesign settings will be used for app-store .ipa/.app export:
development team: mycompany AB (B6V4GVD2QJ)
codesign identity: Apple Distribution: mycompany AB (B6V4GVD2QJ) [1185290782025666350]
provisioning profiles: Bitrise iOS app-store - (com.mycompany.supply) -> com.mycompany.supply
                       Bitrise iOS app-store - (com.mycompany.supply.myproject-Notification-Service-Extension) -> com.mycompany.supply.myproject-Notification-Service-Extension

Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]:


Required Identities/Certificates (2)
- Apple Distribution: mycompany AB (B6V4GVD2QJ)
- Apple Development: Firstname Lastname (2U7AUQMY83)

Exporting the Identities (Certificates):
searching for Identity: Apple Distribution: mycompany AB (B6V4GVD2QJ)
searching for Identity: Apple Development: Firstname Lastname (2U7AUQMY83)
exporting Identity: Apple Distribution: mycompany AB (B6V4GVD2QJ)
exporting Identity: Apple Development: Firstname Lastname (2U7AUQMY83)

Exporting from Keychain using empty Passphrase...
This means that if you want to import the file the passphrase at import should be left empty,
you don't have to type in anything, just leave the passphrase input empty.

You'll most likely see popups one for each Identity from Keychain,
you will have to accept (Allow) those to be able to export the Identities!

Required Provisioning Profiles (4)
- Bitrise iOS app-store - (com.mycompany.supply.myproject-Notification-Service-Extension) (UUID: c279bbeb-3aa7-4210-8920-71b65ad9d7fd)
- iOS Team Provisioning Profile: com.mycompany.supply (UUID: 369da9a2-4554-44e6-beb5-45ea3e9c1349)
- iOS Team Provisioning Profile: com.mycompany.supply.myproject-Notification-Service-Extension (UUID: 2968498b-63cc-423f-a454-416159e6e44b)
- Bitrise iOS app-store - (com.mycompany.supply) (UUID: 4649ed22-c4c1-4e1e-b8f9-d2c5a2130d3e)

Exporting Provisioning Profiles...
searching for required Provisioning Profile: Bitrise iOS app-store - (com.mycompany.supply.myproject-Notification-Service-Extension) (UUID: c279bbeb-3aa7-4210-8920-71b65ad9d7fd)
file found at: /Users/myuser/Library/MobileDevice/Provisioning Profiles/c279bbeb-3aa7-4210-8920-71b65ad9d7fd.mobileprovision
searching for required Provisioning Profile: iOS Team Provisioning Profile: com.mycompany.supply (UUID: 369da9a2-4554-44e6-beb5-45ea3e9c1349)
file found at: /Users/myuser/Library/MobileDevice/Provisioning Profiles/369da9a2-4554-44e6-beb5-45ea3e9c1349.mobileprovision
searching for required Provisioning Profile: iOS Team Provisioning Profile: com.mycompany.supply.myproject-Notification-Service-Extension (UUID: 2968498b-63cc-423f-a454-416159e6e44b)
file found at:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4059fce]

goroutine 1 [running]:
github.com/bitrise-io/codesigndoc/codesign.exportProvisioningProfiles(0xc0018cc700, 0x4, 0x4, 0x0, 0xc00189b000, 0x2, 0x2, 0xc001856c80)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/codesign/export.go:251 +0x518
github.com/bitrise-io/codesigndoc/codesign.ExportCodesigningFiles(0xc00189b000, 0x2, 0x2, 0xc0018cc700, 0x4, 0x4, 0xc0018cc700, 0x0, 0x0, 0x0, ...)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/codesign/export.go:62 +0xe0
github.com/bitrise-io/codesigndoc/codesigndoc.CodesigningFilesForXCodeProject(0xc0020db440, 0x60, 0xc000150000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0020db440, ...)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/codesigndoc/xcode.go:67 +0x133
github.com/bitrise-io/codesigndoc/cmd.scanXcodeProject(0x4965040, 0x49872e0, 0x0, 0x0, 0x0, 0x0)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/cmd/xcode.go:131 +0x270
github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra.(*Command).execute(0x4965040, 0x49872e0, 0x0, 0x0, 0x4965040, 0x49872e0)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra/command.go:826 +0x465
github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x4964640, 0x4529c74, 0xe, 0x0)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra/command.go:914 +0x2fc
github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra.(*Command).Execute(...)
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/vendor/github.com/spf13/cobra/command.go:864
github.com/bitrise-io/codesigndoc/cmd.Execute()
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/cmd/root.go:38 +0x32
main.main()
	/Users/vagrant/go/src/github.com/bitrise-io/codesigndoc/main.go:8 +0x20
@Roland-Bak
Copy link

Hi there @klokie

Can you please send us the log file or the URL of the related build and also enable Support Access on the Settings tab of the app ( https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/ ) so that we can take a more in-depth look? 🙂

@klokie
Copy link
Author

klokie commented Jul 12, 2021

Thanks for your reply.
I've enabled "Bitrise Support User for this app". However, the error results from running the codesigndoc script locally as specified in the documentation. The complete (obfuscated) log is included in my previous post.

@klokie
Copy link
Author

klokie commented Aug 13, 2021

hi @Roland-Bak just checking in after a month to see if there's anything I can do to help debug this? thanks

@Roland-Bak
Copy link

Hello @klokie 👋

Sorry for the delay, could you also send us the URL link of your build (as well as re-enable Support Access)? I will check with the experts to see why this doesn't work on Bitrise. There might be alternative ways we can go about with code signing 🙂

@klokie
Copy link
Author

klokie commented Aug 19, 2021

Great, appreciate the help @Roland-Bak. I've re-enabled Support for the app, latest build at https://app.bitrise.io/build/9c2000ad-2c44-4ebe-addf-52c7c62bddce#?tab=log

@Roland-Bak
Copy link

Hello @klokie 👋

I checked your build, and one thing I noticed is that you set up an Apple Connection with Apple ID, but the step you are using in the workflow is an iOS Auto Provisioning with API. Can you let me know if switching it to the step that uses iOS Auto Provision with Apple ID changes anything? 🙂

@klokie
Copy link
Author

klokie commented Aug 20, 2021

Thanks, I've tried that but the error I've noted above is produced when I run codesigndoc locally, where it crashes every time I run it.
My hope is that we can use it to get our certificates and signing profiles in order to successfully deploy to the app store from Bitrise, which has been failing with signing-related error messages, even though I can build and deploy the app from my local XCode.

@klokie
Copy link
Author

klokie commented Aug 20, 2021

I don't know Go yet but there seems to be a bug in FindProvisioningProfile that would allow it to return an "invalid memory address or nil pointer dereference" to the exportProvisioningProfiles function, which results in the crash.

@Roland-Bak
Copy link

Hello @klokie 👋

I wanted to let you know that this is indeed an issue and our developers are working on a fix! Once there is progress, you'll be notified 🙂

@klokie
Copy link
Author

klokie commented Aug 25, 2021

Great! Looking forward to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants