@@ -290,17 +290,29 @@ func buildConfiguration(helper *projectmanager.ProjectHelper, targetName, config
290290 configuration = helper .MainTarget .BuildConfigurationList .DefaultConfigurationName
291291 }
292292
293+ var xcodeprojTarget * xcodeproj.Target
293294 for _ , target := range helper .XcProj .Proj .Targets {
294- if target .Name != targetName {
295- continue
295+ if target .Name == targetName {
296+ xcodeprojTarget = & target
297+ break
296298 }
299+ }
297300
298- for _ , buildConfig := range target .BuildConfigurationList .BuildConfigurations {
299- if buildConfig .Name == configuration {
300- return & buildConfig , nil
301- }
301+ if xcodeprojTarget == nil {
302+ return nil , fmt .Errorf ("target '%s' not found in project: %s" , targetName , helper .XcProj .Path )
303+ }
304+
305+ var xcodeprojBuildConfiguration * xcodeproj.BuildConfiguration
306+ for _ , buildConfig := range xcodeprojTarget .BuildConfigurationList .BuildConfigurations {
307+ if buildConfig .Name == configuration {
308+ xcodeprojBuildConfiguration = & buildConfig
309+ break
302310 }
303311 }
304312
305- return nil , fmt .Errorf ("" )
313+ if xcodeprojBuildConfiguration == nil {
314+ return nil , fmt .Errorf ("build configuration '%s' not found for target '%s' in project: %s" , configuration , targetName , helper .XcProj .Path )
315+ }
316+
317+ return xcodeprojBuildConfiguration , nil
306318}
0 commit comments