@@ -44,6 +44,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
4444 let defaultsPath = " /usr/bin/defaults "
4545 let codesignPath = " /usr/bin/codesign "
4646 let securityPath = " /usr/bin/security "
47+ let chmodPath = " /bin/chmod "
4748
4849 //MARK: Drag / Drop
4950 var fileTypes : [ String ] = [ " ipa " , " deb " , " app " , " xcarchive " , " mobileprovision " ]
@@ -216,7 +217,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
216217
217218 var index : Int
218219
219- for index = 0 ; index <= rawResult. count - 2 ; index += 2 {
220+ for index in 0 . stride ( through : rawResult. count - 2 , by : 2 ) {
220221 if !( rawResult. count - 1 < index + 1 ) {
221222 output. append ( rawResult [ index+ 1 ] )
222223 }
@@ -232,7 +233,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
232233 alert. addButtonWithTitle ( " No " )
233234 if alert. runModal ( ) == NSAlertFirstButtonReturn {
234235 if let tempFolder = makeTempFolder ( ) {
235- fixSigning ( tempFolder)
236+ iASShared . fixSigning ( tempFolder)
236237 try ? fileManager. removeItemAtPath ( tempFolder)
237238 populateCodesigningCerts ( )
238239 }
@@ -444,12 +445,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
444445 }
445446 return nil
446447 }
447- func fixSigning( tempFolder: String ) {
448- let script = " do shell script \" /bin/bash \\ \" \( NSBundle . mainBundle ( ) . pathForResource ( " fix-wwdr " , ofType: " sh " ) !) \\ \" \" with administrator privileges "
449- NSAppleScript ( source: script) ? . executeAndReturnError ( nil )
450- //https://developer.apple.com/certificationauthority/AppleWWDRCA.cer
451- return
452- }
448+
453449 func startSigning( ) {
454450 controlsEnabled ( false )
455451
@@ -459,7 +455,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
459455 saveDialog. nameFieldStringValue = InputFileText . stringValue. lastPathComponent. stringByDeletingPathExtension
460456 if saveDialog. runModal ( ) == NSFileHandlingPanelOKButton {
461457 outputFile = saveDialog. URL!. path
462- NSThread . detachNewThreadSelector ( Selector ( " signingThread " ) , toTarget: self , withObject: nil )
458+ NSThread . detachNewThreadSelector ( #selector ( self . signingThread) , toTarget: self , withObject: nil )
463459 } else {
464460 outputFile = nil
465461 controlsEnabled ( true )
@@ -529,7 +525,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
529525 alert. informativeText = " You appear to have a error with your codesigning certificate, do you want me to try and fix the problem? "
530526 let response = alert. runModal ( )
531527 if response == NSAlertFirstButtonReturn {
532- self . fixSigning ( tempFolder)
528+ iASShared . fixSigning ( tempFolder)
533529 if self . testSigning ( signingCertificate!, tempFolder: tempFolder) == false {
534530 let errorAlert = NSAlert ( )
535531 errorAlert. messageText = " Unable to Fix "
@@ -757,19 +753,24 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
757753 }
758754 } else {
759755 setStatus ( " Unable to read entitlements from provisioning profile " )
760- warnings++
756+ warnings += 1
761757 }
762758 if profile. appID != " * " && ( newApplicationID != " " && newApplicationID != profile. appID) {
763759 setStatus ( " Unable to change App ID to \( newApplicationID) , provisioning profile won't allow it " )
764760 cleanup ( tempFolder) ; return
765761 }
766762 } else {
767763 setStatus ( " Unable to parse provisioning profile, it may be corrupt " )
768- warnings++
764+ warnings += 1
769765 }
770766
771767 }
772768
769+ //MARK: Make sure that the executable is well... executable.
770+ if let bundleExecutable = getPlistKey ( appBundleInfoPlist, keyName: " CFBundleExecutable " ) {
771+ NSTask ( ) . execute ( chmodPath, workingDirectory: nil , arguments: [ " 755 " , appBundlePath. stringByAppendingPathComponent ( bundleExecutable) ] )
772+ }
773+
773774 //MARK: Change Application ID
774775 if newApplicationID != " " {
775776
@@ -834,7 +835,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
834835 if codesignOutput. status != 0 {
835836 setStatus ( " Error codesigning \( shortName ( file, payloadDirectory: payloadDirectory) ) " )
836837 Log . write ( codesignOutput. output)
837- warnings++
838+ warnings += 1
838839 }
839840 }
840841
@@ -850,7 +851,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
850851 //MARK: Codesigning - Eggs
851852 let eggSigningFunction = generateFileSignFunc ( eggDirectory, entitlementsPath: entitlementsPlist, signingCertificate: signingCertificate!)
852853 func signEgg( eggFile: String ) {
853- eggCount++
854+ eggCount += 1
854855
855856 let currentEggPath = eggDirectory. stringByAppendingPathComponent ( " egg \( eggCount) " )
856857 let shortName = eggFile. substringFromIndex ( payloadDirectory. endIndex)
0 commit comments