Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status bar throw error in ios #2299

Closed
joebnb opened this issue Jan 21, 2025 · 4 comments
Closed

Status bar throw error in ios #2299

joebnb opened this issue Jan 21, 2025 · 4 comments
Labels

Comments

@joebnb
Copy link

joebnb commented Jan 21, 2025

this line

import Foundation
import Capacitor

/**
 * StatusBar plugin. Requires "View controller-based status bar appearance" to
 * be "YES" in Info.plist
 */
@objc(StatusBarPlugin)
public class StatusBarPlugin: CAPPlugin, CAPBridgedPlugin {
    public let identifier = "StatusBarPlugin"
    public let jsName = "StatusBar"
    public let pluginMethods: [CAPPluginMethod] = [
        CAPPluginMethod(name: "setStyle", returnType: CAPPluginReturnPromise),
        CAPPluginMethod(name: "setBackgroundColor", returnType: CAPPluginReturnPromise),
        CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
        CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise),
        CAPPluginMethod(name: "getInfo", returnType: CAPPluginReturnPromise),
        CAPPluginMethod(name: "setOverlaysWebView", returnType: CAPPluginReturnPromise)
    ]
    private var statusBar: StatusBar?    // not import
    private let statusBarVisibilityChanged = "statusBarVisibilityChanged"
    private let statusBarOverlayChanged = "statusBarOverlayChanged"

    override public func load() {
        guard let bridge = bridge else { return }
        statusBar = StatusBar(bridge: bridge, config: statusBarConfig())
    }

    private func statusBarConfig() -> StatusBarConfig {
        var config = StatusBarConfig()
        config.overlaysWebView = getConfig().getBoolean("overlaysWebView", config.overlaysWebView)
        if let colorConfig = getConfig().getString("backgroundColor"), let color = UIColor.capacitor.color(fromHex: colorConfig) {
            config.backgroundColor = color

    /@capacitor/status-bar/ios/Sources/StatusBarPlugin/StatusBarPlugin.swift:20:28:
        error: cannot find type 'StatusBar' in scope
        private var statusBar: StatusBar?
        ^~~~~~~~~
       /@capacitor/status-bar/ios/Sources/StatusBarPlugin/StatusBarPlugin.swift:29:39:
        error: cannot find type 'StatusBarConfig' in scope
        private func statusBarConfig() -> StatusBarConfig {
        ^~~~~~~~~~~~~~~
     /@capacitor/status-bar/ios/Sources/StatusBarPlugin/StatusBarPlugin.swift:125:33:
        error: cannot find type 'StatusBarInfo' in scope
        private func toDict(_ info: StatusBarInfo) -> [String: Any] {
        ^~~~~~~~~~~~~
        
        warning: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because
        it does not specify any outputs. To address this issue, either add output dependencies to the script
        phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the
        script phase. (in t
@ionitron-bot ionitron-bot bot added the triage label Jan 21, 2025
@joebnb joebnb changed the title Status bar throw error Status bar throw error in ios Jan 21, 2025
@xjobs-app
Copy link

Hello, did you find a solution?

@joebnb
Copy link
Author

joebnb commented Feb 13, 2025

Hello, did you find a solution?

nop

@joebnb
Copy link
Author

joebnb commented Feb 21, 2025

Hello, did you find a solution?

this worked for me https://capacitorjs.com/docs/ios/spm#converting-existing-plugins-to-spm

@joebnb joebnb closed this as completed Feb 21, 2025
Copy link

ionitron-bot bot commented Mar 8, 2025

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants