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

iOS build fails with "SecKey API returned: -25308" "codesign failed with exit code 1" #8953

Open
wuftymerguftyguff opened this issue Mar 22, 2017 · 6 comments
Labels
P2 Important issues not at the top of the work list platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team

Comments

@wuftymerguftyguff
Copy link

Steps to Reproduce

Follow Getting started guide to create to create default "myapp"

Able to launch against simulator, but get following error against real iDevice

first run i get the standard message:

Could not build the precompiled application for the device.
══════════════════════════════════════════════════════════════════
Building an iOS app requires a selected Development Team with a Provisioning Profile
Please ensure that a Development Team is selected by:
  1- Opening the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- In the 'General' tab, make sure a 'Development Team' is selected

For more information, please visit:
  https://flutter.io/setup/#deploy-to-ios-devices

I open the workspace as suggested and add my team. (Xcode set for automatic management of signing, I have a a valid wildcard provisioning profile)

i run flutter run again and get this error

      /usr/bin/codesign --force --sign 7D8FC5A3FC9ADE6BFAA1B387E733C232D239A97F --preserve-metadata=identifier,entitlements --timestamp=none /Users/jeffa/Documents/myapp/build/ios/Release-iphoneos/Runner.app/Frameworks/Flutter.framework
    SecKey API returned: -25308, (null)/Users/jeffa/Documents/myapp/build/ios/Release-iphoneos/Runner.app/Frameworks/Flutter.framework: unknown error -1=ffffffffffffffff
    Command /usr/bin/codesign failed with exit code 1
    
Could not build the precompiled application for the device.

If I build/run the target from inside Xcode it launches on the device and runs.

Please tell us what you were doing and what went wrong. If you are running flutter tools from the command line, please try adding the -v or --verbose option to gather more information.

 myapp $ flutter doctor -v 
[�[1m +178 ms�[0m] /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[  +95 ms] Exit code 0 from: /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[        ] 2.3
[  +12 ms] [/Users/jeffa/Documents/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +10 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/master
[        ] [/Users/jeffa/Documents/flutter/] git ls-remote --get-url origin
[   +9 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[        ] [/Users/jeffa/Documents/flutter/] git log -n 1 --pretty=format:%H
[  +12 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 15e51a9e3ed59b70605629b8bab1106b22354472
[        ] [/Users/jeffa/Documents/flutter/] git log -n 1 --pretty=format:%ar
[   +7 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[        ] 17 hours ago
[  +50 ms] �[1m[‚úì] Flutter (on Mac OS X 10.12.3 16D32, channel master)�[0m
[        ] �[1m    ‚Ä¢ Flutter at /Users/jeffa/Documents/flutter�[0m
[        ] �[1m    ‚Ä¢ Framework revision 15e51a9e3e (17 hours ago), 2017-03-22 01:42:40�[0m
[        ] �[1m    ‚Ä¢ Engine revision 6b9eda4a40�[0m
[        ] �[1m    ‚Ä¢ Tools Dart version 1.23.0-dev.9.0�[0m
[  +28 ms] �[1m[‚úì] Host Executable Compatibility�[0m
[        ] �[1m    ‚Ä¢ Downloaded executables execute on host�[0m
[   +2 ms] /usr/libexec/java_home
[  +30 ms] Exit code 0 from: /usr/libexec/java_home
[   +1 ms] java -version
[�[1m +288 ms�[0m] �[1m[‚úì] Android toolchain - develop for Android devices (Android SDK 25.0.2)�[0m
[        ] �[1m    ‚Ä¢ Android SDK at /Users/jeffa/Library/Android/sdk�[0m
[        ] �[1m    ‚Ä¢ Platform android-25, build-tools 25.0.2�[0m
[        ] �[1m    ‚Ä¢ Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java�[0m
[        ] �[1m    ‚Ä¢ Java version: Java(TM) SE Runtime Environment (build 1.8.0_77-b03)�[0m
[   +2 ms] xcode-select --print-path
[   +7 ms] Exit code 0 from: xcode-select --print-path
[        ] /Applications/Xcode.app/Contents/Developer
[        ] xcodebuild -version
[  +81 ms] Exit code 0 from: xcodebuild -version
[        ] Xcode 8.2.1
           Build version 8C1002
[        ] xcrun clang
[  +12 ms] python -c import six
[  +99 ms] ideviceinstaller -h
[  +11 ms] ios-deploy --version
[  +17 ms] ios-deploy --version
[  +10 ms] Exit code 0 from: ios-deploy --version
[        ] 1.9.1
[        ] idevice_id -h
[   +6 ms] ios-deploy --version
[   +9 ms] ios-deploy --version
[   +8 ms] Exit code 0 from: ios-deploy --version
[        ] 1.9.1
[   +1 ms] idevice_id -l
[  +15 ms] 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[        ] ideviceName
[�[1m +103 ms�[0m] pod --version
[�[1m +429 ms�[0m] pod --version
[�[1m +421 ms�[0m] Exit code 0 from: pod --version
[        ] 1.2.0
[        ] pod --version
[�[1m +413 ms�[0m] Exit code 0 from: pod --version
[        ] 1.2.0
[        ] �[1m[‚úì] iOS toolchain - develop for iOS devices (Xcode 8.2.1)�[0m
[        ] �[1m    ‚Ä¢ Xcode at /Applications/Xcode.app/Contents/Developer�[0m
[        ] �[1m    ‚Ä¢ Xcode 8.2.1, Build version 8C1002�[0m
[        ] �[1m    ‚Ä¢ ios-deploy 1.9.1�[0m
[        ] �[1m    ‚Ä¢ CocoaPods version 1.2.0�[0m
[   +1 ms] �[1m[‚úì] Android Studio (version 2.3)�[0m
[        ] �[1m    ‚Ä¢ Android Studio at /Applications/Android Studio.app/Contents�[0m
[        ] �[1m    ‚Ä¢ Gradle version 3.2�[0m
[   +3 ms] /Users/jeffa/Library/Android/sdk/platform-tools/adb devices -l
[  +14 ms] Exit code 0 from: /Users/jeffa/Library/Android/sdk/platform-tools/adb devices -l
[        ] List of devices attached
[  +16 ms] idevice_id -h
[   +6 ms] which idevice_id
[   +4 ms] Exit code 0 from: which idevice_id
[        ] /usr/local/bin/idevice_id
[        ] /usr/local/bin/idevice_id -l
[   +6 ms] Exit code 0 from: /usr/local/bin/idevice_id -l
[        ] 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[        ] which ideviceinfo
[   +3 ms] Exit code 0 from: which ideviceinfo
[        ] /usr/local/bin/ideviceinfo
[        ] /usr/local/bin/ideviceinfo -k DeviceName -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[  +91 ms] Exit code 0 from: /usr/local/bin/ideviceinfo -k DeviceName -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[        ] JPHONE
[        ] which ideviceinstaller
[   +4 ms] Exit code 0 from: which ideviceinstaller
[        ] /usr/local/bin/ideviceinstaller
[        ] which idevice_id
[   +3 ms] Exit code 0 from: which idevice_id
[        ] /usr/local/bin/idevice_id
[        ] which ideviceinfo
[   +3 ms] Exit code 0 from: which ideviceinfo
[        ] /usr/local/bin/ideviceinfo
[        ] which iproxy
[   +3 ms] Exit code 0 from: which iproxy
[        ] /usr/local/bin/iproxy
[        ] which idevicedebug
[   +3 ms] Exit code 0 from: which idevicedebug
[        ] /usr/local/bin/idevicedebug
[        ] which idevicesyslog
[   +3 ms] Exit code 0 from: which idevicesyslog
[        ] /usr/local/bin/idevicesyslog
[        ] which idevicescreenshot
[   +4 ms] Exit code 0 from: which idevicescreenshot
[        ] /usr/local/bin/idevicescreenshot
[        ] which ios-deploy
[   +4 ms] Exit code 0 from: which ios-deploy
[        ] /usr/local/bin/ios-deploy
[   +2 ms] /usr/bin/xcrun simctl list --json devices
[�[1m +106 ms�[0m] which ideviceinfo
[   +4 ms] Exit code 0 from: which ideviceinfo
[        ] /usr/local/bin/ideviceinfo
[        ] /usr/local/bin/ideviceinfo -k ProductVersion -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[  +51 ms] Exit code 0 from: /usr/local/bin/ideviceinfo -k ProductVersion -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[        ] 10.2.1
[        ] which ideviceinfo
[   +4 ms] Exit code 0 from: which ideviceinfo
[        ] /usr/local/bin/ideviceinfo
[        ] /usr/local/bin/ideviceinfo -k BuildVersion -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[  +46 ms] Exit code 0 from: /usr/local/bin/ideviceinfo -k BuildVersion -u 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a
[        ] 14D27
[   +2 ms] �[1m[‚úì] Connected devices�[0m
[        ] �[1m    ‚Ä¢ JPHONE   ‚Ä¢ 3d8b0e4ef50ee06b16f82dbef3f7c8af20df310a ‚Ä¢ ios ‚Ä¢ iOS 10.2.1 (14D27)�[0m
[        ] �[1m    ‚Ä¢ iPhone 6 ‚Ä¢ 19D068F4-F0DA-4F31-8FA3-A52546429DB1     ‚Ä¢ ios ‚Ä¢ iOS 10.2 (simulator)�[0m
[        ] 'flutter doctor' took 2765ms.
[�[1m +260 ms�[0m] ensureAnalyticsSent: 258ms
[   +2 ms] exiting with code 0

myapp $ flutter analyze
Analyzing lib/main.dart...
No analyzer warnings! (ran in 6.0s)

@cbracken
Copy link
Member

The error message above looks suspiciously like:
http://stackoverflow.com/questions/41451502/xcodebuild-error-seckey-api-returned-25308
which links here:
http://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p

Can you let me know if those steps work? If so, I'll see what we can do in flutter doctor to catch this early and emit useful steps to take.

@cbracken
Copy link
Member

If you don't mind, can you also attach the output of flutter doctor? That way we've got the version info of what's currently broken.

@cbracken cbracken added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Mar 22, 2017
@wuftymerguftyguff
Copy link
Author

Output of flutter doctor, as requested

[‚úì] Flutter (on Mac OS X 10.12.3 16D32, channel master)
    • Flutter at /Users/jeffa/Documents/flutter
    • Framework revision 15e51a9e3e (19 hours ago), 2017-03-22 01:42:40
    • Engine revision 6b9eda4a40
    • Tools Dart version 1.23.0-dev.9.0

[‚úì] Host Executable Compatibility
    • Downloaded executables execute on host

[‚úì] Android toolchain - develop for Android devices (Android SDK 25.0.2)
    • Android SDK at /Users/jeffa/Library/Android/sdk
    • Platform android-25, build-tools 25.0.2
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java
    • Java version: Java(TM) SE Runtime Environment (build 1.8.0_77-b03)

[‚úì] iOS toolchain - develop for iOS devices (Xcode 8.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 8.2.1, Build version 8C1002
    • ios-deploy 1.9.1
    • CocoaPods version 1.2.0

[‚úì] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Gradle version 3.2

[‚úì] Connected devices
    • iPhone 6 • 19D068F4-F0DA-4F31-8FA3-A52546429DB1 • ios • iOS 10.2 (simulator)

@wuftymerguftyguff
Copy link
Author

wuftymerguftyguff commented Mar 22, 2017

I ran this as mentioned in the second stack overflow link above.

security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k <keychainPass> login.keychain

flutter run now works with a real ios device.

So i thought I would try this to recreate the issue,

security set-key-partition-list -S apple-tool:,apple: -s -k <keychainPass> login.keychain

but it still works...

So I think this is the root issue, but more work is needed to detect it somehow.

@johnmccutchan johnmccutchan added this to the 3: Make conferences happy milestone Mar 23, 2017
@Hixie
Copy link
Contributor

Hixie commented Nov 29, 2017

I'm going to move this to the next milestone because it's not on our current priority list, but please let us known if this is impeding your progress so that we can reconsider our priorities accordingly.

@Hixie Hixie modified the milestones: 3: Current Milestone, 4: Next milestone Nov 29, 2017
@Hixie Hixie removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 24, 2018
@xster xster added this to Tooling in iOS Framework Feb 26, 2019
@jmagman jmagman added this to Awaiting triage in Tools - iOS review Jan 10, 2020
@jmagman
Copy link
Member

jmagman commented Jan 23, 2020

Related to #7765.

@jmagman jmagman added this to Awaiting triage in Tools - Xcode review via automation Jan 23, 2020
@jmagman jmagman removed this from Awaiting triage in Tools - iOS review Jan 23, 2020
@jmagman jmagman added the t: xcode "xcodebuild" on iOS and general Xcode project management label Jan 23, 2020
@jmagman jmagman moved this from Awaiting triage to Engineer reviewed in Tools - Xcode review Jan 23, 2020
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@kf6gpe kf6gpe removed this from the Goals milestone Jun 2, 2020
@Hixie Hixie removed this from the Goals milestone Jun 2, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@jmagman jmagman changed the title Problems following "Getting Started" with a physical iOS device iOS build fails with "SecKey API returned: -25308" "codesign failed with exit code 1" Dec 11, 2020
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team
Projects
Tools - Xcode review
  
Engineer reviewed
iOS Framework
  
Tooling
Development

No branches or pull requests

6 participants