Ok I got a mac os command which works fine
security import "/Users/xxx/Documents/AppCompiler/temp/CordovaBuildFiles/Certificates/IOSRelease/ios_Production.p12" -k "$KEYCHAIN" -P "PASSWORD" -A
But if I want to make it a little dynamic by storing the P12 into a variable it fails with 'No such file or directoryile ios_Production.p12'
CERT="/Users/xxx/Documents/AppCompiler/temp/CordovaBuildFiles/Certificates/IOSRelease/ios_Production.p12"
security import "$CERT" -k "$KEYCHAIN" -P "$PASSWORD" -A
I have also tried setting $CERT="ios_Production.p12" and moving to the folder before calling.
Can anyone share any light on what can cause this to happen?
**Updated as Mark Setchell pointed out a code error - thanks mark in the original. I have also altered the folder where it is stored.
There full error returned is: security: Error reading infile /Users/xxx/Documents/AppCompiler/temp/Cordov: No such file or directorySRelease/ios_Production.p12
OK I decided to move ios_Production.p12 into Documents folder and it worked, so I created another CERT line then folder by folder added them back in and for reasons I am really confused about it now works. Below are the two lines:
cert="/Users/xxx/Documents/AppCompiler/temp/CordovaBuildFiles/Certificates/IOSRelease/ios_Production.p12"
cert="/Users/xxx/Documents/AppCompiler/temp/CordovaBuildFiles/Certificates/IOSRelease/ios_Production.p12"
You will be forgiven for thinking you are seeing double because you are 100%, I have compared them in a diff checker but depending which line is commented out depends if the import works or not. I really hope this makes some form of sense to someone because I'm going bald here...
Try it like this:
CERT="/Users/xxx/Documents/AppCompiler/keys/prod/prodx.p12"
security import "$CERT" -k "$KEYCHAIN" -P "$PASSWORD" -A
The syntax is like this. If you set a shell variable, do this with no dollar and no spaces:
variable="..."
If you access the contents of a variable, surround with double quotes and use a dollar:
echo "$variable"
And, in general, avoid variables names consisting of upper case letters to be sure not to clash with built-in variables, so your CERT
should really be cert
, but that is not really the point here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.