Thursday, July 17, 2014

Passing parameters to javascript action methods

http://stackoverflow.com/questions/8442552/passing-parameters-to-a-jquery-function-from-a-button-click


Wednesday, July 9, 2014

Re-codesign iPhone apps (.ipa files) with Enterprise Certificates

http://avinashdongarwar.blogspot.com/2013/12/re-codesign-iphone-apps-ipa-files-with.html

Pre-Requisites

1)   Download the distribution certificate from iOS Developer Enterprise Program account. Include it in keychain by double clicking on downloaded .cer file. 
2)   Download the provisioning profile for the app that needs to be resigned from  iOS Developer Enterprise Program Account.
3)   Have the .ipa file of the app that needs to be resigned.

How to Re-sign -
 Lets say Application.ipa is the one we are re-signing.
Open terminal  and -
1)  Unzip the .ipa file.
unzip Application.ipa 
2)  At this stage, you will be having a directory named “Payload” in your working directory with a file with .app extension inside.  In this case it will be Application.app.
3)  In case you want to check the signing authority of the app -
 codesign -dvv Payload/Application.app
4)  Remove old code signature.
rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
5)   In case Bundle identifier used for registering the application while creating provisioning profile through Enterprise account differs from what was used while signing the app for the first time, we need to change Bundle               identifier using Plistbuddy.
/usr/libexec/PlistBuddy Payload/Apps.app/Info.plist
Use following commands -
a)  Set :CFBundleIdentifier
b)  Save
c)  Quit
6)  In case app uses OS capabilities like Shared keychain, SSO, push notifications etc. we need to add an entitlements property list while resigning in order to enable App Sandbox for the application. For example:
. A new entilements file can be created using –
     /usr/bin/codesign -d --entitlements :entitlements.plist Payload/Application.app
7)  Open the entitlements.plist and edit it.
a) vi entitlements.plist
b) Press i.
c) Entilements.plist looks like -
UTF-8
"?>
http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
        application-identifier
        XXXXXXXX.
        get-task-allow
       
        keychain-access-groups
       
                XXXXXXXX.
                XXXXXXXX.< keychain group id>
                …………..etc………..
       

In the above chunk, XXXXXXXX part has to be replaced with team ID of the Enterprise Account.
d)  Press esc
e)  :wq!
8) Replace embedded provisioning profile.
cp "" "Payload/Apps.app/embedded.mobileprovision"
9) Re-sign








 /usr/bin/codesign -f -s "" --resource-rules "Payload/Application.app/ResourceRules.plist" --entitlements entitlements.plist "Payload/Application.app"
Certificate Authorities can be even checked in "Keychain Access" Utility application on MAC systems. Open "Keychain Access"  and search with keyword "iPhone Distribution".
  
10) Repackage
    zip -qr "Application.resigned.ipa" Payload

Wednesday, July 2, 2014

Resigning an application

http://avinashdongarwar.blogspot.com/2013/12/re-codesign-iphone-apps-ipa-files-with.html