rubymotion-community / motion-provisioning

Simplified provisioning for RubyMotion iOS, tvOS and macOS apps.
Other
46 stars 20 forks source link

Can 'rake device' from one Mac, but not from another, with same Motion Provisioning #13

Closed itsterry closed 7 years ago

itsterry commented 7 years ago

Here's a weird one. I recently got a new MacBook Pro (yay!). Everything works nicely in my simulator, but 'rake device' fails with 'The specified item could not be found in the keychain'

The same code still deploys nicely using 'rake device' on my previous MacBook Pro, so I'm guessing it's a certificate thing.

I'm using Motion Provisioning, (of course!) which should take care of my certs

My keychain shows the appropriate cert in the 'Certificates' list in Keychain Access The Provisioning profile shows the device in 'ProvisionedDevices' in the build's embedded.mobileprovision file

Here's the output from 'rake device --trace'

Invoke device (first_time) Invoke archive (first_time) Invoke build:device (first_time) Execute build:device Info Using certificate 'iPhone Developer: Terry Shuttleworth (46K3D9CXH7)'. Info Using provisioning profile '(MotionProvisioning) com.morsedigital.helpware2 ios development'. rm -f ./build/iPhoneOS-9.3-Development/nav.app/Info.plist /usr/bin/ar -rc "libext.a" CoreDataQueryManagedObjectBase.m.o /usr/bin/ranlib "libext.a" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o "./build/iPhoneOS-9.3-Development/nav.app/nav" -filelist "/var/folders/2n/_8tdxrn97mg12m0hs0l2g69r0000gn/T/linker-objs-list20161216-10241-1yvqxe8" -arch arm64 -arch armv7 -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk" -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks -miphoneos-version-min=9.3 -Wl,-no_pie -L"/Library/RubyMotion/data/ios/9.3/iPhoneOS" -lrubymotion-static -lobjc -licucore -framework AddressBook -framework AddressBookUI -framework CFNetwork -framework CoreAudio -framework CoreData -framework CoreFoundation -framework CoreGraphics -framework CoreLocation -framework CoreMotion -framework Foundation -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework Security -framework SpriteKit -framework SystemConfiguration -framework UIKit -force_load "/Users/terry/.rvm/gems/ruby-2.3.3/gems/motion-yaml-1.6.1/lib/YAMLKit/libYAMLKit_iOS.a" -force_load "/Users/terry/.rvm/gems/ruby-2.3.3/gems/cdq-1.0.0/vendor/cdq/ext/build-iPhoneOS/libext.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libAFNetworking.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libISO8601DateFormatterValueTransformer.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libRestKit.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libRKValueTransformers.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libSOCKit.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libSVProgressHUD.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libTPKeyboardAvoiding.a" -force_load "/Users/terry/ios/helpware_ios/vendor/Pods/build-iPhoneOS/libTransitionKit.a" ld: warning: -no_pie ignored for arm64 /usr/bin/plutil -convert binary1 "./build/iPhoneOS-9.3-Development/nav.app/Info.plist" /usr/bin/dsymutil "./build/iPhoneOS-9.3-Development/nav.app/nav" -o "./build/iPhoneOS-9.3-Development/nav.app.dSYM" while processing /Users/terry/.rvm/gems/ruby-2.3.3/gems/motion-yaml-1.6.1/lib/YAMLKit/libYAMLKit_iOS.a(YKEmitter.o): warning: /var/folders/zm/rqj5mcrx0pg0j9mslw69ctnc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/YAMLKit_Prefix-berfqicfzenrkfgqbeeevjiesmcj/YAMLKit_Prefix.pch.pch: No such file or directory while processing /Users/terry/.rvm/gems/ruby-2.3.3/gems/motion-yaml-1.6.1/lib/YAMLKit/libYAMLKit_iOS.a(YKEmitter.o): warning: /var/folders/zm/rqj5mcrx0pg0j9mslw69ctnc0000gn/C/com.apple.DeveloperTools/7.2-7C68/Xcode/SharedPrecompiledHeaders/YAMLKit_Prefix-exmqkmtyfvenfseuaqkwegrdrscd/YAMLKit_Prefix.pch.pch: No such file or directory CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate" /usr/bin/codesign -f -s "iPhone Developer: Terry Shuttleworth (46K3D9CXH7)" --entitlements ./build/iPhoneOS-9.3-Development/Entitlements.plist "./build/iPhoneOS-9.3-Development/nav.app" error: The specified item could not be found in the keychain. rake aborted! Command failed with status (1): [CODESIGN_ALLOCATE="/Applications/Xcode.app...]

I'm guessing the important bit is

CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate" /usr/bin/codesign -f -s "iPhone Developer: Terry Shuttleworth (46K3D9CXH7)" --entitlements ./build/iPhoneOS-9.3-Development/Entitlements.plist "./build/iPhoneOS-9.3-Development/nav.app" error: The specified item could not be found in the keychain.

I've tried 'rake device recreate_profile=1', but it doesn't fix it

I remember there was a way to put the device id into the rake device command, but despite a bunch of Googling, I can't find it again (is there a page anywhere with the 'rake device' options listed? - I've tried 'motion ri rake')

Any ideas anyone? (I also posted this to Rubymotion Community, just in case anyone there has solved already)

itsterry commented 7 years ago

SOLVED.

It looks like an issue with my Xcode management.

I hadn't added my Apple Developer Account to Xcode. I did this, then

RESET my iOS Development and Distribution signing identities, then

rake device recreate_profile=1

And all became good.

Closing this issue.

MarkVillacampa commented 7 years ago

You could have also ran the command with recreate_certificate, which does the same as recreate_profile but for the certificate.

motion-provisioning has a bunch of checks to make sure the certificate and private key are properly installed in the keychain, so my only guess is the codesignbinary is not looking in the same keychain as motion-provisioning 🤔

itsterry commented 7 years ago

Thanks Mark: I didn't know about recreate_certificate. Filed for future use!

I didn't copy over any files from the old Mac, but I did do a side-by-side in 'Keychain Access' with the two machines. I noticed that on the old machine (on which 'rake device' worked) there was no entry for the private key, while there WAS an entry for the private key on the new one. That flummoxed me a little, as I was expecting it to be the other way round.

Even so, it now works, so life is good :)

Thank you for following up. SO impressed with motion-provisioning - you've removed the biggest pain point (I've encountered so far) of iOS dev work: appreciated!