프로그래밍/flutter

[flutter] home_widget 0.4.0 이용하여 iOS 홈위젯 생성 방법

소행성왕자 2023. 12. 7. 17:45

 

flutter 프로젝트에서 xcode 실행

 ✘ nayakim  ~/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03   main ±✚  ll
total 40
-rw-r--r--@  1 nayakim  staff    78B Dec  7 11:25 analysis_options.yaml
drwxr-xr-x@  9 nayakim  staff   288B Dec  7 11:33 android
drwxr-xr-x   6 nayakim  staff   192B Dec  7 11:34 build
drwxr-xr-x@  3 nayakim  staff    96B Dec  7 11:25 fonts
drwxr-xr-x@ 13 nayakim  staff   416B Dec  7 16:01 ios
drwxr-xr-x@  6 nayakim  staff   192B Dec  7 11:25 lib
-rw-r--r--   1 nayakim  staff    10K Dec  7 13:43 pubspec.lock
-rw-r--r--@  1 nayakim  staff   482B Dec  7 11:31 pubspec.yaml

$ open ios/Runner.xcworkspace

 

안드로이드 스튜디오에서 빌드시 오류

Error (Xcode): Cycle inside Runner; building could produce unreliable results.
Cycle details:
→ Target 'Runner': CodeSign /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app
○ That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
○ Target 'Runner' has copy command from '/Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/NewsWidgetsExtension.appex' to '/Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex'
○ That command depends on command in Target 'Runner': script phase “Thin Binary”
○ Target 'Runner' has process command with output '/Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Info.plist'
○ Target 'Runner' has copy command from '/Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/NewsWidgetsExtension.appex' to '/Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex'


Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/_CodeSignature ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:CodeSign /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/home_widget.framework/ ->

directoryTreeSignature: � ->

directoryContents: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/home_widget.framework ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/home_widget.framework ->

command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:PhaseScriptExecution [CP] Embed Pods Frameworks /Users/nayakim/Library/Developer/Xcode/DerivedData/Runner-cbyngmkoviymtrczkbmoisrjpjro/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-EB7A56367F54EA5D752EBF12.sh ->

node: /Users/nayakim/Library/Developer/Xcode/DerivedData/Runner-cbyngmkoviymtrczkbmoisrjpjro/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/InputFileList-EB7A56367F54EA5D752EBF12-Pods-Runner-frameworks-Debug-input-files-8464b52b8aa593256f14846c02e6b9c2-resolved.xcfilelist ->

command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:WriteAuxiliaryFile /Users/nayakim/Library/Developer/Xcode/DerivedData/Runner-cbyngmkoviymtrczkbmoisrjpjro/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/InputFileList-EB7A56367F54EA5D752EBF12-Pods-Runner-frameworks-Debug-input-files-8464b52b8aa593256f14846c02e6b9c2-resolved.xcfilelist ->

node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5-copy-files> ->

command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase5-copy-files ->

node: <Copy /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex> ->

CYCLE POINT ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:Copy /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/NewsWidgetsExtension.appex ->

node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary> ->

command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-thin-binary ->

node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e02f1eee2015e8ff5ebcd27678f788c2826-target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-> ->

command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:PhaseScriptExecution Thin Binary /Users/nayakim/Library/Developer/Xcode/DerivedData/Runner-cbyngmkoviymtrczkbmoisrjpjro/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-3B06AD1E1E4923F5004D2608.sh ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Info.plist/ ->

directoryTreeSignature: � ->

directoryContents: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Info.plist ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Info.plist ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:ProcessInfoPlistFile /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/Info.plist /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/ios/Runner/Info.plist ->

node: /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:Copy /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/Runner.app/PlugIns/NewsWidgetsExtension.appex /Users/nayakim/Documents/naya/program/mobile/flutter/flutter-codelabs/homescreen_codelab/step_03/build/ios/Debug-iphonesimulator/NewsWidgetsExtension.appex

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

해결방법

xcode 실행후 원본

드래그로 이동하면 정상적으로 됨

Widget + 추가시 이름 변경

ios/Runner/Info.plist

<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Home Widget Test22</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
...

xcode 에서는

위젯 displayName 과 desc 수정

 

 

참고

https://pub.dev/packages/home_widget

 

home_widget | Flutter Package

A plugin to provide a common interface for creating HomeScreen Widgets for Android and iOS.

pub.dev

https://www.youtube.com/watch?v=NoTc1D26HAo

https://developer.apple.com/forums/thread/731825

 

Xcode 15 only produces a cycle ins… | Apple Developer Forums

My app builds fine with Xcode 14, 13 and 12, but when attempting to build it with Xcode 15 there's an "Cycle inside MyApp; building could produce unreliable results." error. The output below isn't giving me any clues that I can see about what the cause of

developer.apple.com