Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
/* Begin XCBuildConfiguration section */
51B5D3242F05143A0090B8B4 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReferenceAnchor = 51B5D31A2F0514390090B8B4 /* Cherrish-iOS */;
baseConfigurationReferenceRelativePath = Core/Config.xcconfig;
Comment on lines +152 to +153
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Debug와 Release에 동일한 Config 파일 사용 검토

현재 Debug와 Release 모두 동일한 Core/Config.xcconfig를 참조합니다. 개발 환경과 프로덕션 환경에서 다른 BASE_URL이 필요한 경우, 환경별로 분리된 설정 파일 사용을 권장합니다.

예시:

  • Config-Debug.xcconfig → 개발 서버 URL
  • Config-Release.xcconfig → 프로덕션 서버 URL

Also applies to: 217-218

🤖 Prompt for AI Agents
In `@Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj` around lines 152 - 153,
The project currently points both Debug and Release build configurations to the
same Core/Config.xcconfig via baseConfigurationReferenceRelativePath and
baseConfigurationReferenceAnchor; split this by creating Config-Debug.xcconfig
and Config-Release.xcconfig (with environment-specific BASE_URL values) and
update the project.pbxproj entries that use
baseConfigurationReferenceRelativePath = Core/Config.xcconfig (and the matching
baseConfigurationReferenceAnchor occurrences) so that the Debug configuration
references Config-Debug.xcconfig and the Release configuration references
Config-Release.xcconfig; repeat the same change for the other identical
baseConfigurationReference entries in the file.

buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -212,6 +214,8 @@
};
51B5D3252F05143A0090B8B4 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReferenceAnchor = 51B5D31A2F0514390090B8B4 /* Cherrish-iOS */;
baseConfigurationReferenceRelativePath = Core/Config.xcconfig;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down
12 changes: 12 additions & 0 deletions Cherrish-iOS/Cherrish-iOS/Core/BaseURL.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// BaseURL.swift
// Cherrish-iOS
//
// Created by 송성용 on 1/18/26.
//

import Foundation

enum Environment {
static let baseURL: String = Bundle.main.infoDictionary?["BASE_URL"] as! String
}
Comment on lines +10 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Force cast 사용으로 인한 런타임 크래시 위험

as! String 강제 캐스팅은 BASE_URL이 누락되거나 타입이 맞지 않을 경우 앱 크래시를 유발합니다. 안전한 옵셔널 바인딩 또는 명시적 에러 처리를 권장합니다.

🔧 안전한 구현 제안
 enum Environment {
-    static let baseURL: String = Bundle.main.infoDictionary?["BASE_URL"] as! String
+    static let baseURL: String = {
+        guard let url = Bundle.main.infoDictionary?["BASE_URL"] as? String else {
+            fatalError("BASE_URL이 Info.plist에 정의되지 않았습니다. Config.xcconfig 설정을 확인하세요.")
+        }
+        return url
+    }()
 }

이 방식은 크래시 시 명확한 에러 메시지를 제공하여 디버깅을 용이하게 합니다.

🧰 Tools
🪛 SwiftLint (0.57.0)

[Error] 11-11: Force casts should be avoided

(force_cast)

🤖 Prompt for AI Agents
In `@Cherrish-iOS/Cherrish-iOS/Core/BaseURL.swift` around lines 10 - 12, The
Environment.baseURL currently force-casts
Bundle.main.infoDictionary?["BASE_URL"] as! String which can crash if the key is
missing or not a String; update Environment.baseURL to safely unwrap and
validate Bundle.main.infoDictionary?["BASE_URL"] (e.g., use guard let base = ...
as? String else { fatalError("Missing or invalid BASE_URL in Info.plist") } or
return a sensible default) so the lookup for "BASE_URL" fails with a clear error
message instead of a runtime cast exception.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protocol EndPoint {

extension EndPoint {
var requestURL: URL {
let baseURL = "" // TODO: 서버 배포 후 수정
let baseURL = Environment.baseURL
let urlString = baseURL + basePath + path

guard var urlComponents = URLComponents(string: urlString) else {
Expand Down
2 changes: 2 additions & 0 deletions Cherrish-iOS/Cherrish-iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BASE_URL</key>
<string>$(BASE_URL)</string>
Comment on lines +5 to +6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for Config.xcconfig file in the repository
echo "=== Searching for Config.xcconfig ===" 
fd -t f "Config\.xcconfig" --exec sh -c 'echo "Found: {}" && cat "{}"' \;

# Also search for any .xcconfig files to get a broader view
echo ""
echo "=== All .xcconfig files in repository ===" 
fd -t f "\.xcconfig$"

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 150


🏁 Script executed:

#!/bin/bash
# Check if .xcconfig files are gitignored
echo "=== Checking .gitignore for .xcconfig patterns ===" 
if [ -f ".gitignore" ]; then
  cat .gitignore | grep -i "xcconfig" || echo "No .xcconfig patterns found in .gitignore"
else
  echo ".gitignore not found"
fi

echo ""
echo "=== Searching for BASE_URL definition in all files ===" 
rg "BASE_URL" --type-list | head -5
rg "BASE_URL" -t swift -t plist -t xml 2>/dev/null | head -20

echo ""
echo "=== Checking for README or setup documentation ===" 
fd -t f "(README|SETUP|CONFIG)" --exec sh -c 'echo "File: {}" && head -10 "{}"' \; 2>/dev/null | head -50

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1142


🏁 Script executed:

#!/bin/bash
# Check for template or example .xcconfig files
echo "=== Searching for .xcconfig templates or examples ===" 
fd -i "xcconfig|config" -t f | grep -E "(example|template|sample)" || echo "No template files found"

echo ""
echo "=== Searching all files for BASE_URL reference ===" 
rg "BASE_URL" 2>/dev/null | head -20

echo ""
echo "=== Checking Info.plist files ===" 
fd "Info\.plist" -t f --exec sh -c 'echo "File: {}" && cat "{}"' \;

echo ""
echo "=== Checking Xcode project structure ===" 
fd "\.pbxproj" -t f | head -5

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 1125


🏁 Script executed:

#!/bin/bash
# Check pbxproj for BASE_URL or build configuration
echo "=== Checking pbxproj for BASE_URL or build settings ===" 
rg "BASE_URL|xcconfig" "Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj" 2>/dev/null | head -20

echo ""
echo "=== Checking for build scripts or setup documentation ===" 
fd -t f "(Makefile|\.sh|\.yml|\.yaml)" --exec sh -c 'basename "{}" && head -5 "{}"' \; 2>/dev/null | head -50

echo ""
echo "=== Checking for any .swift files that reference xcconfig ===" 
rg "xcconfig|CONFIG" --type swift 2>/dev/null | head -10

echo ""
echo "=== Full README.md to check for setup instructions ===" 
cat README.md | head -100

Repository: TEAM-Cherrish/Cherrish-iOS

Length of output: 3130


Config.xcconfig 파일 생성 필수

Info.plist에서 참조하는 $(BASE_URL) 변수는 Core/Config.xcconfig 파일에서 정의되어야 합니다. Xcode 프로젝트 설정(pbxproj)에 이 파일이 baseConfigurationReferenceRelativePath로 이미 지정되어 있으나, 파일이 .gitignore에 등록되어 있어 저장소에는 포함되지 않습니다.

각 개발자가 로컬에서 직접 Cherrish-iOS/Core/Config.xcconfig 파일을 생성하고 BASE_URL 값을 정의해야 프로젝트가 정상적으로 빌드됩니다. README에 이에 대한 설정 가이드를 추가하거나, Config.xcconfig.example 템플릿 파일을 제공하는 것을 권장합니다.

🤖 Prompt for AI Agents
In `@Cherrish-iOS/Cherrish-iOS/Info.plist` around lines 5 - 6, Info.plist
references the build variable $(BASE_URL) which must be defined in
Cherrish-iOS/Core/Config.xcconfig; create that file locally (or add a checked-in
template Config.xcconfig.example) and define BASE_URL (e.g. BASE_URL =
https://api.example.com), ensure the Xcode project’s
baseConfigurationReferenceRelativePath continues to point to
Core/Config.xcconfig, and update README with instructions to copy
Config.xcconfig from the example and set the local value so the project can
build for all developers.

<key>UIAppFonts</key>
<array>
<string>Pretendard-Bold.otf</string>
Expand Down