How to debug a Cordova app showing blank screen in XCode Simulator - xcode

We inherited an app where the frontend is built in Vue 2 and the mobile app built with cordova-ios (6.2.0) and cordova-android (10.1.1). It has built ok and loaded in the XCode (13.2.1) simulator until recently.
It's got some fairly old packages which I upgraded, and managed to get it to run both in vue ui and Android Studio (Chipmunk). (I had upgraded the packages because somewhere along the line that build broke -- so I deleted node_modules and package-lock.json, then upgraded packages one by one until I got it working again.)
However, when I do the Cordova build for iOS, open the project in XCode, do an XCode build, then open it up in a simulator, the screen is completely blank.
These are the only files that changed in version control between releases:
package.json
package-lock.json
babel.config.js
(various Vue files under src/views)
I'm fairly new to mobile development so don't really know how to proceed. How would I go about debugging the project (simulator, XCode, whatever) to see what has broken?
Any extra information you need please ask.
Edit 1: Avinash's suggestion about debugging via Safari Dev Console was a good tip (thanks Avinash). I've checked the app HTML vs a working build and it seems somehow the injection of the app content into <div id="app"> is not happening. In the android version it's fine, so maybe something in the cordova build is not happy.
There's an error message in the debug logging in XCode saying it could not load the "LaunchStoryboard" image referenced from a nib in the bundle with identifier which is also different from the output in a working build.

Avinash's suggestion is spot on in that it can help troubleshoot startup problems (I've had to do this a bunch of times myself). From your update, it sounds like there's an issue with the splash screen configuration.
There's some iOS specific documentation for the splash screen plugin on the Cordova documentation website. A couple tips that might be useful in tracking down the issue:
You can use a single image for the splash screen if desired. I've got just one defined for my app (the needed dimensions are defined in the Cordova docs above):
<platform name="iOS">
...
<splash src="www/res/screen/ios/Default#2x~universal~anyany.png" />
</platform>
I have also run into issues where the storyboard file has gotten corrupted, probably by me falling on my keyboard and clicking on something while the editor was open. To rebuild, you can remove and re-add the iOS platform:
$ cordova platform rm ios
$ cordova platform add ios
This should copy over the splash image and rebuild the storyboard file.

Related

How to display images in Muti-Platform Xamarin.Forms Project on iOS

I've got a Xamarin.Forms Project containing an Android and an iOS Platform Project.
I've got my whole application working on Android and I am now struggling on the iOS part. I can't get my images to display on iOS.
I've followed the Microsoft guide on how to work with images on Xamarin.iOS, but it's simply not working.
I have created a minimum example from a new project and uploaded it to GitHub, it can be found here.
Output: On Android, the image is being displayed fine, on iOS, the screen stays empty. In addition to that, the logs I've added to AppDelegate.cs show, that the images cannot be found by using UIImage.FromBundle()
I've also checked the CSProject file of the iOS project, but it already contains the <ImageAsset> item groups.
I am on Visual Studio Professional 2022 (Windows) Version 17.4.1
Can someone please have a look into this? I am going crazy...
I have test your project with the Visual Studio 2022 for mac. And I had the same results in the Android platform and ios platform. The small car icon will show at the top of the screen.
But for the iphone 14 pro simulator, which has a notch screen. The car icon almost be covered. So you can try to run it on the ipad or a device without notch screen to check the car icon will show or not.
In addition, I have checked your Assets.xcassets folder and the official sample on the github. There is no a such xxx_vector folder in it.
Background information:
What's deprecated (but still works) is individual resource files (aaa.png, aaa#x2.png), with no xcasset.
An xcasset containing those files is not deprecated. Nor is it likely to become deprecated in the future.
If you still want to test with .pdf containing vectors:
What is problematic about your setup is that you have TWO representations of car_settings. One with .pngs, one with vector pdf.
What happens if you remove the xcasset with .pngs, and rename the one with pdf to match the filename in it? (car_settings xcasset, with car_settings.pdf).
Close VS, and delete all .bin and .obj folders after making this change, to ensure VS correctly rebuilds with the vector version.
If this still fails, then you likely have encountered a bug. Add as an issue at github xamarin forms issues. Be sure to mention the versions of VS and Xamarin.Forms that has the problem.

Flutter - Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator

After updating to Catalina 10.15.4 beta with Xcode 13.4 beta, which also updated Simulator to 13.4 (921.4).
The application compiles and runs correctly on a physically attached device, but no simulators of any devices can pass this stage.
I got the errors
Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator.
or
Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS.
How can I fix this?
Xcode 11.4 changed the way frameworks are linked and embedded, and you may experience issues switching between iOS devices and simulators. Flutter v1.15.3 and later will automatically migrate your Xcode project.
To get unstuck, follow the instructions below;
Quick fix (make your simulator work)
rm -rf ios/Flutter/App.framework
Official recommended Steps to migrate manually
From the Flutter app directory, open ios/Runner.xcworkspace in
Xcode.
In the Navigator pane, locate the Flutter group and remove App.framework and Flutter.framework.
In the Runner target build settings Build Phases > Link Binary With Libraries confirm App.framework and Flutter.framework are no longer present. Also confirm in Build Phases > Embed Frameworks.
Change the Runner target build settings Build Phases > Thin Binary script as follows:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"
embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"
thin
In the Runner target Build Settings > Other Linker Flags
(OTHER_LDFLAGS) add $(inherited) -framework Flutter
Hope it helps!
Select your Target from "TARGETS"
Select 'Build Settings'
Under 'Build Options' -> Set 'Validate Workspace' To 'YES'
After successfully building, set it back to 'NO'
Reason :
"In Xcode 12+, the default option for Validate Workspace is internally not set. We need to set it manually to avoid this kind of error. There is no problem in setting back to the default 'NO' option.
Xcode 11.4 changed the way frameworks are linked and embedded, which is causing issues switching between iOS devices and simulators.
Please follow official guide on how to migrate your project.
After several days trying to find a solution to test the Flutter app on iOS device, I finally found this:
flutter clean
flutter build ios
-Open xCode and run app on your device.
Updated to Xcode 11.4. Ios 13.4, Iphone X. App just fetches data using API.
App started on white screen and then finally crashes, both on simulator and device.
I followed the offical guide (I also rm -rf ios/Flutter/App.framework)
flutter.dev/docs/development/ios-project-migration.
I ran several times flutter clean
I also tried deleting Pods/ folder and Podfile.lock, then reinstalling using pod install in the ios folder.
As I am using async data I also added as 1st line in main()
WidgetsFlutterBinding.ensureInitialized();
No help, app did not started either simulator.
Then I removed ios/ and android/ folders. After that in project folder I ran command flutter create . that regenerates mentioned folders.
After this my app started fine both on simulator and on device.
I hope this would be help to others. NOTE!! if you have done any modifications manually to those folders please take backup or commit beforehand.
I have tried the solution on the official website of flutter but it didn't work for me, so I found a temporary solution which worked for me, but it took me some hard works:
Here is my example with project stuck_framework which is a fresh new project (first time run on the simulator)
I created 2 folders inside flutter project called
"ios_simulator" and "ios_real_device".
enter image description here
Now my first build was for the simulator, then I want to switch to a real device, I will move ios folder inside Flutter project to the "ios_simulator"
I open the project with visual studio code and run "flutter create ." and now I will choose a real device to rebuild the project ( if your simulator is online, please quit ).
enter image description here
Now I wait for the build finish and run on the real device without any errors. Now I have 2 ios project 1 for simulators and one for real devices.
Next time when I want to run on the simulator again, I just remove the current ios folder and copy the ios folder which I placed on "ios_simulator" back out to flutter project folder. Hope this help
Manually upgrading flutter to version 1.15 solve this issue as well. Running flutter version v1.15.17 helped me.
Also, you can switch to beta or dev channels by running flutter channel command but be sure you check your code against all BC changes...
In my case, it works only simulator(debug). if you want to deploy your app on the app store(release) i highly recommend you to upgrade flutter version using
flutter version v1.15.17
otherwise you would encounter crashed app with white screen.
just upgrade flutter version then all things work well
This error is caused by the Xcode 11.4 and can be resolved by Removing / Re-Embedding frameworks and adding a new Run Script Phase.
Under General -> "Frameworks, Libraries, and Embedded Content"
Delete the frameworks that are causing errors.
After deleting, re-embed the frameworks in the same location.
Under Build Phases add a new run script phase.
Select the "+" button in the "Build Phases" pane to create a "New Run Script Phase".
Confirm the script is the bottommost build phase, and configure its fields.
The Shell text field should read /bin/sh (which is the default value).
In the text-input area, enter the shell command rm -r "FRAMEWORK_DIRECTORY/YOUR_FRAMEWORK.framework/"
None of the other solutions here worked for me. In my case, the problem was fixed by searching my project for ONLY_ACTIVE_ARCH and changing them all to YES. I found my solution here:
https://developer.apple.com/forums/thread/656509

Archived macOS app launches with blank window

I have a macOS app with a ViewController that renames and resizes the app window, has several buttons, and a WKWebView that loads a default webpage on launch.
The project itself is an .xcworkspace file, since it includes the CocoaPod SwiftSoup for HTML scraping.
The app runs great in the simulator. When it launches, it looks like this:
I want to run this app on my Mac outside of Xcode. I am not planning on releasing it to the App Store, it is just for my personal use.
I archive the project with Products > Archive, then select "Distribute App", then "Copy App" to create a directory with the archived app. This all works great.
When I launch the app, I just get an incorrectly sized blank title-less window, without the buttons or WKWebView from my Storyboard:
The app isn't hanging. I can open the "About" menu item, etc., so I know the app is running. it just doesn't seem to be using my Storyboard to draw the UI.
What would cause an archived app to differ from the app running in the simulator?
The funny thing is that I WAS able to archive this same app back in November under High Sierra, so I'm guessing the issue is either Cocoa Pods and/or Mojave related.
My debugging leads me to suspect either CocoaPods or Mojave related
My debug:
1) While debugging, I restored a version of the project from November. When I archive that restored project, I get the same blank non running app.
2) I AM able to archive another brand new project that doesn't use Cocoa Pods, so my guess is that this is either CocoaPods and/or Mojave related issue...
Any suggestions on how to proceed debugging, or help resolving this would be greatly appreciated!
I am using Xcode 10.2.1 under Mojave 10.14.5.
This problem is caused by WKWebView.
So, you need remove WKWebView from IB and then create it with code and add it to the view.
REFER:
https://forums.developer.apple.com/thread/116047
http://www.openradar.me/23699297

Xcode 5.1 Cordova iOS config.xml

I know there are several issues with the new version of xcode 5.1/cordova and it simply wont run apps on 64x bit devices / emu but I followed this tutorial and now it somehow works (even though it spits 14 warnings in my case)
But for some reasons config.xml is still being ignored. It's in red and you can't edit it.
Any suggestions?
You need to close your xcode. Build again using cordova build and open up again your xcode then you can run your app.

Xcode 5 - "iOS Simulator failed to install application" every time I switch simulators

Using Xcode 5 GM, anytime I switch to the 5.1, 6.0 or 6.1 simulators to test, I get the error "iOS Simulator failed to install application." When I reset the simulator it works, but this is getting very tiring.
Anybody have a permanent fix or workaround?
Looks like this is a known issue. From the Xcode 5 release notes:
After switching the minimum deployment target of an application from
iOS 7.0 to a release prior to iOS 7.0, building and running the
application may fail with the message “iOS Simulator failed to install
the application.”
Go to the iOS home screen, click and hold the application icon, then tap the hovering “X” button to delete the application. 13917023
Another release note:
iOS Simulator
If an iOS app is detached, relaunching the same app from Xcode will
result in a black screen in the Simulator even though the new app is
launched. Terminate the app in the Simulator or relaunch it for the
second time. 14648784
Delete the old version app in your simulator (usually iOS 6.x).
Alternatively, header over to iOS Simulator - Reset Content and Settings.
This can be easier when you have a lot of apps on the simulator and can't remember which one you're currently working on.
You need to do this for every iOS Simulator version that causes the problem.
None of the other suggestions worked for me. However, after comparing my existing app settings to a new vanilla project, I noticed that the "Build" field for my Target was blank. Once I put something in that field, the app installed just fine!
if you have already developed project and you used xib to develop views then
X-Code > Inspector Selector Bar > Interface Builder Document > opens in > and change from Xcode Default(5.o) to Xcode 4.6 .
Build and Run your app it will run successfully, if it won't run again then, header over to iOS Simulator - Reset Content and Settings. delete old app from simulator then Run again.
i got the same problem but solved by following way....
Launch the iOS Simulator
Go and click "iOS Simulator" menu
Click "Reset content and settings"
Close simulator and rebuild your app.
Above screen shot is showing the way how you can do this...
I think this works for you...!!!
Deleting the app in the simulator works for me.
just wanted to add that this happen only if I open xib that created in xcode 4.6
If it's other files, this not happen
try this ....
in my case nothing have worked for me , after resetting the content simulator also , i am not able to install the app on simulator . after that i just changed my project location . i just moved the project to other location . then it installed successfully.
None of the above things worked for me. I just reinstalled xcode and it worked.
Ran into this issue today. Found it was an empty Reference Folder (blue folder) causing this. Removed the folder from Resources in Build Phase... cleaned build folder for the heck of it, and it went away.
/Users/YOURUSERNAME/Library/Developer/Xcode/ --> remove all contents of this folder, then simply launch the app from Xcode.
To check your Executable file settng ex.$(EXECUTABLE_NAME)
(Project setting - info property page)
I have different issue when getting error message “iOS Simulator failed to install application”, the reason is because I have added a property in App-Info.plist without any value. For instance, [Application Category] with no value. Thus the error will show up as well.
When I got this error, the image of the phone actually appeared, but the image of the app I wanted to test did not. Instead, I was on the main page of the phone that shows the apps you have. I fixed this problem by deleting the many icons that appeared on the start screens - about 30 of them. These had been created when I testing apps over the months. So, not saying its a solution, but it started working after I deleted the old app images.
For me it was -framework XCTest.
It made the app die with iOS Simulator failed to install application
and on the device Could not inspect the application package.
Removed it and now works.
You are using Xcode GM which is under beta stage. Use latest Xcode 5.1.1 available.
Also, these error occur while switching between simulator (32 bit and 64 bit).
Quit the simulator and re-build the application. OR
Reset simulator from "iOS simulator" -> "Reset content and settings.."
I changed my app name and bundle id midway. I happened to delete the Executable File name in my plist. I changed it back to "${EXECUTABLE_NAME}" (no quotes) and I'm back in business.

Resources