I'm beginner at XcodeGen and tried to add the iOS 14's widget target to my app
Widget:
type: app-extension
platform: iOS
settings:
INFOPLIST_FILE: PIAWidget/Info.plist
PROVISIONING_PROFILE_SPECIFIER_Release: Development - Widget Extension
OTHER_LDFLAGS: $(inherited) -framework WidgetKit
configFiles:
Debug: Configuration/AppExtension-iOS.xcconfig
Release: Configuration/AppExtension-iOS.xcconfig
sources:
- path: Widget
name: "Extension: Widget"
In the option of the project.yml, the deployment target is iOS 13.0
options:
deploymentTarget:
macOS: "10.14"
iOS: "13.0"
tvOS: "13.0"
settingPresets: none
createIntermediateGroups: true
carthageExecutablePath: Vendor/carthage.command
carthageBuildPath: ${APP_CARTHAGE_BUILD_PATH}
usesTabs: false
indentWidth: 3
tabWidth: 3
In the widget swift class, there is @main
that asked me to add: @available
@available(iOSApplicationExtension 14.0, *)
@main
But after adding it, it still show me that error:
'main()' is only available in application extensions for iOS 14.0 or newer
That is why, I thought maybe I have to add a deploymentTarget
in the widget section. And as I searched it should be like that:
Widget:
type: app-extension
platform: iOS
deploymentTarget:
iOS: "14.0"
settings:
INFOPLIST_FILE: PIAWidget/Info.plist
PROVISIONING_PROFILE_SPECIFIER_Release: Piavet Development - Widget Extension
OTHER_LDFLAGS: $(inherited) -framework WidgetKit
configFiles:
Debug: Configuration/AppExtension-iOS.xcconfig
Release: Configuration/AppExtension-iOS.xcconfig
sources:
- path: Widget
name: "Extension: Widget"
But I still got the error. Could anyone help me on that?
change deploymentTarget from 14.0 to 14.1 like this