rules_apple icon indicating copy to clipboard operation
rules_apple copied to clipboard

scene delegate not called with ios_application

Open chenwu054 opened this issue 5 years ago • 7 comments

I am trying to create a new ios application in swift. and I used ios_application rule to create it with ios version 14.0. But AppDelegate's "application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration " is not called and none of my SceneDelegate method's called. Therefore, my app has a dark screen and no view/window/scene hierarchy. I wonder how can I resolve it. I tried searching the internet but could not find anything useful. Thank you!

chenwu054 avatar Jan 03 '21 00:01 chenwu054

Does your Info.plist contain the relevant keys? I created a fresh project with Xcode and it looks like there are a few that I assume are required:

<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
  <key>UIWindowSceneSessionRoleApplication</key>
  <array>
    <dict>
      <key>UISceneConfigurationName</key>
      <string>Default Configuration</string>
      <key>UISceneDelegateClassName</key>
      <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
    </dict>
  </array>
</dict>

keith avatar Jan 03 '21 00:01 keith

Thank you for your reply! @keith Yes, I have those in my info.plist file. One thing to note is that I cannot have $(PRODUCT_MODULE_NAME) with the error below, but only $(PRODUCT_NAME), possibly due to the reason in https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md


Use --sandbox_debug to see verbose messages from the sandbox ERROR: In target "//

Note: The failure of target @build_bazel_rules_apple//tools/plisttool:plisttool (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.

====================================================================== Here is my Info.plist file.

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_NAME).SceneDelegate</string> </dict> </array> </dict> </dict> <key>UIApplicationSupportsIndirectInputEvents</key> <true/> <key>UIMainStoryboardFile</key> <string>Main</string> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> </dict> </plist>

chenwu054 avatar Jan 03 '21 01:01 chenwu054

Does PRODUCT_NAME end up being correct for your swift_library's module_name? or if you check the produced .ipa and see the derived value in the Info.plist is it correct?

keith avatar Jan 04 '21 23:01 keith

@Keith I have the same problem, any update for this?

unknown variable reference "$(PRODUCT_MODULE_NAME)" while merging plists (key: "UIApplicationSceneManifest:UISceneConfigurations:UIWindowSceneSessionRoleApplication[0]:UISceneDelegateClassName", value: "$(PRODUCT_MODULE_NAME).SceneDelegate").

chenjunpu avatar May 12 '21 15:05 chenjunpu

That issue is different, you can see the details on why that attribute isn't supported here https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#variable-substitution you'll have to replace it manually with your module's name

keith avatar May 13 '21 17:05 keith

Make sure you reference your swift_libary's module_name and not name

davisg123 avatar Jun 08 '21 18:06 davisg123

Info.plist configuration for UIWindowSceneSessionRoleApplication contained the key "Default Configuration" UISceneDelegateClassName but failed to load the class named "FREEDOMINSTACLONE.SceneDelegate". Info.plist configuration for UIWindowSceneSessionRoleApplication contained the key "(no name)" UISceneDelegateClassName but failed to load the class named "FIREASEINSTACLONE.SceneDelegate". Info.plist configuration "Default Configuration" for UIWindowSceneSessionRoleApplication contained the key UISceneDelegateClassName, but failed to load the class named "FREEDOMINSTACLONE.SceneDelegate". Unknown class _TtC20FIRBASEINSTACLONE14ViewController in Interface Builder file. There is no scene delegate set. A scene delegate class must be specified to use a master storyboard file.

[ "HELLO, I AM HAVING THE SAME PROBLEM, CURRENTLY IT STAYS ON BLACK SCREEN ALL THE TIME, EVERYTHING IS PERFECT BUT THERE IS NOTHING IN MY INFO FILE, WHAT IS THE PROBLEM, CAN ANYONE SOLVE IT EXACTLY?"]

omerseze avatar Nov 09 '23 21:11 omerseze