@@ -44,6 +44,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
44
44
let defaultsPath = " /usr/bin/defaults "
45
45
let codesignPath = " /usr/bin/codesign "
46
46
let securityPath = " /usr/bin/security "
47
+ let chmodPath = " /bin/chmod "
47
48
48
49
//MARK: Drag / Drop
49
50
var fileTypes : [ String ] = [ " ipa " , " deb " , " app " , " xcarchive " , " mobileprovision " ]
@@ -216,7 +217,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
216
217
217
218
var index : Int
218
219
219
- for index = 0 ; index <= rawResult. count - 2 ; index += 2 {
220
+ for index in 0 . stride ( through : rawResult. count - 2 , by : 2 ) {
220
221
if !( rawResult. count - 1 < index + 1 ) {
221
222
output. append ( rawResult [ index+ 1 ] )
222
223
}
@@ -232,7 +233,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
232
233
alert. addButtonWithTitle ( " No " )
233
234
if alert. runModal ( ) == NSAlertFirstButtonReturn {
234
235
if let tempFolder = makeTempFolder ( ) {
235
- fixSigning ( tempFolder)
236
+ iASShared . fixSigning ( tempFolder)
236
237
try ? fileManager. removeItemAtPath ( tempFolder)
237
238
populateCodesigningCerts ( )
238
239
}
@@ -444,12 +445,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
444
445
}
445
446
return nil
446
447
}
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
+
453
449
func startSigning( ) {
454
450
controlsEnabled ( false )
455
451
@@ -459,7 +455,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
459
455
saveDialog. nameFieldStringValue = InputFileText . stringValue. lastPathComponent. stringByDeletingPathExtension
460
456
if saveDialog. runModal ( ) == NSFileHandlingPanelOKButton {
461
457
outputFile = saveDialog. URL!. path
462
- NSThread . detachNewThreadSelector ( Selector ( " signingThread " ) , toTarget: self , withObject: nil )
458
+ NSThread . detachNewThreadSelector ( #selector ( self . signingThread) , toTarget: self , withObject: nil )
463
459
} else {
464
460
outputFile = nil
465
461
controlsEnabled ( true )
@@ -529,7 +525,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
529
525
alert. informativeText = " You appear to have a error with your codesigning certificate, do you want me to try and fix the problem? "
530
526
let response = alert. runModal ( )
531
527
if response == NSAlertFirstButtonReturn {
532
- self . fixSigning ( tempFolder)
528
+ iASShared . fixSigning ( tempFolder)
533
529
if self . testSigning ( signingCertificate!, tempFolder: tempFolder) == false {
534
530
let errorAlert = NSAlert ( )
535
531
errorAlert. messageText = " Unable to Fix "
@@ -757,19 +753,24 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
757
753
}
758
754
} else {
759
755
setStatus ( " Unable to read entitlements from provisioning profile " )
760
- warnings++
756
+ warnings += 1
761
757
}
762
758
if profile. appID != " * " && ( newApplicationID != " " && newApplicationID != profile. appID) {
763
759
setStatus ( " Unable to change App ID to \( newApplicationID) , provisioning profile won't allow it " )
764
760
cleanup ( tempFolder) ; return
765
761
}
766
762
} else {
767
763
setStatus ( " Unable to parse provisioning profile, it may be corrupt " )
768
- warnings++
764
+ warnings += 1
769
765
}
770
766
771
767
}
772
768
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
+
773
774
//MARK: Change Application ID
774
775
if newApplicationID != " " {
775
776
@@ -834,7 +835,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
834
835
if codesignOutput. status != 0 {
835
836
setStatus ( " Error codesigning \( shortName ( file, payloadDirectory: payloadDirectory) ) " )
836
837
Log . write ( codesignOutput. output)
837
- warnings++
838
+ warnings += 1
838
839
}
839
840
}
840
841
@@ -850,7 +851,7 @@ class MainView: NSView, NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSes
850
851
//MARK: Codesigning - Eggs
851
852
let eggSigningFunction = generateFileSignFunc ( eggDirectory, entitlementsPath: entitlementsPlist, signingCertificate: signingCertificate!)
852
853
func signEgg( eggFile: String ) {
853
- eggCount++
854
+ eggCount += 1
854
855
855
856
let currentEggPath = eggDirectory. stringByAppendingPathComponent ( " egg \( eggCount) " )
856
857
let shortName = eggFile. substringFromIndex ( payloadDirectory. endIndex)
0 commit comments