如何在 shell iOS 中 运行 xcodebuild 命令

How to run xcodebuild command in shell iOS

我想通过 shell 脚本 运行 这个简单的命令

xcodebuild -workspace jamesAppV2.xcworkspace -scheme jamesAppV2 -configuration Debug -destination 'platform=iOS,name=Shujaat’s iPad' clean test

我 运行 通过命令行在上面的命令上运行正常。

这是我的输出日志

    === CLEAN TARGET AFNetworking OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/AFNetworking.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/AFNetworking.framework

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/AFNetworking.framework.dSYM
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/AFNetworking.framework.dSYM


=== CLEAN TARGET Alamofire OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Alamofire.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Alamofire.framework



=== CLEAN TARGET Firebase OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Firebase.framework.dSYM
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Firebase.framework.dSYM



=== CLEAN TARGET OAuth2iOS OF PROJECT OAuth2 WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework

=== CLEAN TARGET Flurry-iOS-SDK OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Flurry_iOS_SDK.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Flurry_iOS_SDK.framework


=== CLEAN TARGET ForecastIOClient-ForecastIOClient OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.bundle
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.bundle


=== CLEAN TARGET Kingfisher OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Kingfisher.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Kingfisher.framework

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Kingfisher.framework.dSYM
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Kingfisher.framework.dSYM

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/Pods.build/Debug-iphoneos/Kingfisher.build
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/Pods.build/Debug-iphoneos/Kingfisher.build

=== CLEAN TARGET SwiftyJSON OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/SwiftyJSON.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/SwiftyJSON.framework


=== CLEAN TARGET Starscream OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Starscream.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Starscream.framework

=== CLEAN TARGET ForecastIOClient OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.framework

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.framework.dSYM
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/ForecastIOClient.framework.dSYM

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/Pods.build/Debug-iphoneos/ForecastIOClient.build
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/Pods.build/Debug-iphoneos/ForecastIOClient.build

=== CLEAN TARGET Pods-jamesAppV2 OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Pods_jamesAppV2.framework
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/Pods_jamesAppV2.framework

=== CLEAN TARGET jamesAppV2 OF PROJECT jamesAppV2 WITH CONFIGURATION Debug ===

Check dependencies
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'JamesApp/Info.plist'.

Clean.Remove clean /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app
    builtin-rm -rf /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app

** CLEAN SUCCEEDED **

2016-05-05 13:09:29.199 xcodebuild[19632:107456] [MT] IDETestOperationsObserverDebug: (87B2511E-F180-4544-ACFF-1A2C85F77D99) Beginning test session 87B2511E-F180-4544-ACFF-1A2C85F77D99 with Xcode 7D175 on target <DVTiOSDevice: 0x7fea65942410> {
        deviceSerialNumber:         DMRJ2Z2UDJ8T
        identifier:                 3515e210981cf6cd0d1b3539f8bf63617ba19372
        deviceClass:                iPad
        deviceName:                 Shujaat’s iPad
        deviceIdentifier:           3515e210981cf6cd0d1b3539f8bf63617ba19372
        productVersion:             9.3.1
        buildVersion:               13E238
        deviceSoftwareVersion:      9.3.1 (13E238)
        deviceArchitecture:         armv7f
        deviceTotalCapacity:        13446778880
        deviceAvailableCapacity:    8529731584
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        deviceType:                 <DVTDeviceType:0x7fea6547f1d0 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1,
    2
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:             
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    } (9.3.1 (13E238))
2016-05-05 13:09:29.265 xcodebuild[19632:107459]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Logs/Test/D570C24D-9119-4CC6-82D5-69A1CDAD50C1/Session-2016-05-05_13:09:29-0cB4I6.log
=== BUILD TARGET OAuth2iOS OF PROJECT OAuth2 WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/module.modulemap
/bin/mkdir -p /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/Objects-normal/armv7
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/Objects-normal/armv7/OAuth2iOS-OutputFileMap.json
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/unextended-module-overlay.yaml
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/swift-overrides.hmap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2-generated-files.hmap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2-own-target-headers.hmap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/Objects-normal/armv7/OAuth2.LinkFileList
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2-all-non-framework-target-headers.hmap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/unextended-module.modulemap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2-project-headers.hmap
/bin/mkdir -p /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/DerivedSources
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/DerivedSources/OAuth2_vers.c
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2-all-target-headers.hmap
write-file /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Intermediates/OAuth2.build/Debug-iphoneos/OAuth2iOS.build/OAuth2.hmap

Create product structure
/bin/mkdir -p /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework/Modules
/bin/mkdir -p /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework/Headers

ProcessInfoPlistFile /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework/Info.plist OAuth2/Info.plist
    cd /Users/qadirhussain/Desktop/lebijou-jamesapp/OAuth2
    export PATH="/Applications/Xcode 3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode 3.app/Contents/Developer/usr/bin:/Users/qadirhussain/.rvm/gems/ruby-2.2.1/bin:/Users/qadirhussain/.rvm/gems/ruby-2.2.1@global/bin:/Users/qadirhussain/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/qadirhussain/.rvm/bin"
    builtin-infoPlistUtility /Users/qadirhussain/Desktop/lebijou-jamesapp/OAuth2/OAuth2/Info.plist -expandbuildsettings -format binary -platform iphoneos -o /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/OAuth2.framework/Info.plist
:))



Signing Identity:     "iPhone Developer: ***********************

    /usr/bin/codesign --force --sign *********************** --timestamp=none /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app/PlugIns/jamesAppV2Tests.xctest

CodeSign /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app
    cd /Users/qadirhussain/Desktop/lebijou-jamesapp
    export CODESIGN_ALLOCATE="/Applications/Xcode 3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
    export PATH="/Applications/Xcode 3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode 3.app/Contents/Developer/usr/bin:/Users/qadirhussain/.rvm/gems/ruby-2.2.1/bin:/Users/qadirhussain/.rvm/gems/ruby-2.2.1@global/bin:/Users/qadirhussain/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/qadirhussain/.rvm/bin"

Signing Identity:     "iPhone Developer: ***********************"

    /usr/bin/codesign --force --sign *********************** --preserve-metadata=identifier,entitlements --timestamp=none /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app
/Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app: replacing existing signature

MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/3h/1gxh7rf94z9c_f2z13_pxp9m0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/3bc83beb2a7461da70ae62f5027faece/3515e210981cf6cd0d1b3539f8bf63617ba19372/jamesAppV2.app
state->new_bundle: /Users/qadirhussain/Library/Developer/Xcode/DerivedData/jamesAppV2-cszkwmryotqiysalbeblxpdpqbcr/Build/Products/Debug-iphoneos/jamesAppV2.app
state->dst_bundle: /var/folders/3h/1gxh7rf94z9c_f2z13_pxp9m0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/jamesAppV2.app.lXkCLx/jamesAppV2.app_sparse.ipa/Payload//jamesAppV2.app, binaryDiff flag: FALSE
    dst_ipa: /var/folders/3h/1gxh7rf94z9c_f2z13_pxp9m0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/jamesAppV2.app.lXkCLx/jamesAppV2.app_sparse.ipa
__MDMDirectoryDiff_block_invoke37:1473 calling writeDictToFile with: /var/folders/3h/1gxh7rf94z9c_f2z13_pxp9m0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/jamesAppV2.app.lXkCLx/jamesAppV2.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/3h/1gxh7rf94z9c_f2z13_pxp9m0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/jamesAppV2.app.lXkCLx/jamesAppV2.app_sparse.ipa/ManifestCache.plist
didFinishLaunchingWithOptions
Connecting Socket didFinishLaunchingWithOptions
battery_level_percentage 56
Activate our screensaver
idleTimerDisabled true
applicationWillEnterForeground
2016-05-05 13:05:53.923 jamesAppV2[245:26657] Flurry: Starting session on Agent Version [Flurry_iOS_160_7.1.1] 
applicationDidBecomeActive
1
13:05:55.145 jamesAppV2[245:26679] _XCT_testBundleReadyWithProtocolVersion:minimumVersion: reply received
13:05:55.470 jamesAppV2[245:26679] _IDE_startExecutingTestPlanWithProtocolVersion:16
Test Suite 'All tests' started at 2016-05-05 13:05:55.593
Test Suite 'jamesAppV2Tests.xctest' started at 2016-05-05 13:05:55.601
Test Suite 'James_App_Tests' started at 2016-05-05 13:05:55.606
Test Case '-[jamesAppV2Tests.James_App_Tests testExample]' started.
Test Case '-[jamesAppV2Tests.James_App_Tests testExample]' passed (0.010 seconds).
Test Case '-[jamesAppV2Tests.James_App_Tests testPerformanceExample]' started.
2
<unknown>:0: Test Case '-[jamesAppV2Tests.James_App_Tests testPerformanceExample]' measured [Time, seconds] average: 0.000, relative standard deviation: 76.169%, values: [0.000028, 0.000009, 0.000006, 0.000006, 0.000006, 0.000006, 0.000006, 0.000006, 0.000006, 0.000006], performanceMetricID:com.apple.XCTPerformanceMetric_WallClockTime, baselineName: "", baselineAverage: , maxPercentRegression: 10.000%, maxPercentRelativeStandardDeviation: 10.000%, maxRegression: 0.100, maxStandardDeviation: 0.100
Test Case '-[jamesAppV2Tests.James_App_Tests testPerformanceExample]' passed (0.496 seconds).
Test Suite 'James_App_Tests' passed at 2016-05-05 13:05:56.121.
     Executed 2 tests, with 0 failures (0 unexpected) in 0.506 (0.516) seconds
Test Suite 'jamesAppV2Tests.xctest' passed at 2016-05-05 13:05:56.127.
     Executed 2 tests, with 0 failures (0 unexpected) in 0.506 (0.525) seconds
Test Suite 'All tests' passed at 2016-05-05 13:05:56.131.
     Executed 2 tests, with 0 failures (0 unexpected) in 0.506 (0.538) seconds
** TEST SUCCEEDED **

但是从 shell 脚本它抛出一个错误。

xcodebuild: error: Scheme jamesAppV2 is not currently configured for the test action.

这是我的一个简单的衬里 shell 脚本

#!/bin/bash
#My First Script

xcodebuild -workspace jamesAppV2.xcworkspace -scheme jamesAppV2 -configuration Debug -destination 'platform=iOS,name=Shujaat’s iPad' clean test

我觉得这看起来很奇怪运行。 shell xcodebuild命令有没有错误?

正如我们在评论中看到的那样,这里的问题是您 运行 使用 sudo 设置脚本。这意味着执行它的用户是 root 而不是您的用户。这意味着完全不同的环境和多个其他设置。

因此,为了模仿您在 shell 中所做的事情,通常 运行 脚本通常不会提及 sudo:

./script.sh   # no sudo