0

尝试 rake 我正在处理的项目时出现以下错误,我不知道为什么。无论我发送什么变量,该消息都会发生。

Objective-C stub for message `setTranslucent:' type `v@:c' not precompiled. Make sure you properly link with the framework or library that defines this message

这是我的 app_delegate 文件供参考。

class AppDelegate

def application(application, didFinishLaunchingWithOptions:launchOptions)
     navigation_appearance
     @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
     tableView = StopsController.alloc.init 
     @window.rootViewController = UINavigationController.alloc.initWithRootViewController(tableView)
     @window.makeKeyAndVisible
     true
end


def navigation_appearance
    UINavigationBar.appearance.setBackgroundImage UIImage.imageNamed('navbar_bg.png'),
    forBarMetrics: UIBarMetricsDefault
    UINavigationBar.appearance.setTranslucent(true)
    UINavigationBar.appearance.setShadowImage UIImage.imageNamed('navbar_shadow.png')   
end

end
4

1 回答 1

0

看起来您没有在 UINavigationBar 的实例上设置属性 -

class AppDelegate

def application(application, didFinishLaunchingWithOptions:launchOptions)
     @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
     tableView = StopsController.alloc.init 
     @navigationController = UINavigationController.alloc.initWithRootViewController(tableView)
     @window.rootViewController = @navigationController
     navigation_appearance
     @window.makeKeyAndVisible
     true
end


def navigation_appearance
    @navigationController.navigationBar.setBackgroundImage UIImage.imageNamed('navbar_bg.png'),
    forBarMetrics: UIBarMetricsDefault
    @navigationController.navigationBar.setTranslucent(true)
    @navigationController.navigationBar.setShadowImage UIImage.imageNamed('navbar_shadow.png')   
end

end

应该管用!

于 2013-06-30T22:17:34.197 回答