Implement BuildInfo plugin for iOS
This commit implements the BuildInfo Capacitor plugin for iOS to retrieve the app version and build number from Info.plist. This resolves an issue where the version information was not being updated on iOS devices due to the absence of a native plugin implementation.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
||||
import { getAppVersionInfo, isAndroidPlatform } from '@/utils/platform';
|
||||
import { getAppVersionInfo, isAndroidPlatform, isIOSPlatform } from '@/utils/platform';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
interface AppVersionInfoProps {
|
||||
@@ -22,7 +22,7 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
pluginResponse?: string;
|
||||
}>({
|
||||
versionName: '1.0.1',
|
||||
buildNumber: 2
|
||||
buildNumber: 3
|
||||
});
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState(false);
|
||||
@@ -34,7 +34,8 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
setError(false);
|
||||
try {
|
||||
console.log('앱 버전 정보 요청 시작... (retries:', retries, ')');
|
||||
console.log('현재 플랫폼은', isAndroidPlatform() ? 'Android' : '기타');
|
||||
console.log('현재 플랫폼은',
|
||||
isAndroidPlatform() ? 'Android' : isIOSPlatform() ? 'iOS' : '웹');
|
||||
|
||||
// 재시도를 하는 경우 짤은 지연 추가
|
||||
if (retries > 0) {
|
||||
@@ -56,7 +57,7 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
|
||||
setVersionInfo({
|
||||
versionName: info.versionName || '1.0.1',
|
||||
buildNumber: isNaN(buildNumber) ? 2 : buildNumber,
|
||||
buildNumber: isNaN(buildNumber) ? 3 : buildNumber,
|
||||
versionCode: info.versionCode,
|
||||
platform: info.platform,
|
||||
pluginResponse: info.pluginResponse
|
||||
|
||||
Reference in New Issue
Block a user