NSInternalInconsistencyException: bundleURL must be non-nil when not implementing loadSourceForBridge - ios

I recently started to get this error (detailed error below) in my iOS mobile app built using react-native. This only happens when I try to run the app on the phone by using Option 2 which is to load using a static bundle. I have tried:
Clean and rebuild in Xcode
Reset cache and run react packager
Uninstall the app on the phone
Coming from Windows background, I have also tried to reboot my machine
Error in Xcode
2016-08-04 09:34:37.611 GalarmApp[367:165469] *** Assertion failure in
-[RCTBatchedBridge loadSource:](), /Users/abc/Projects/GalarmApp/node_modules/react-native/React/Base/RCTBatchedBridge.m:180 2016-08-04 09:34:37.613 GalarmApp[367:165469] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bundleURL must be non-nil when not implementing loadSourceForBridge'
*** First throw call stack: (0x182b32db0 0x182197f80 0x182b32c80 0x1834b81c0 0x1000af788 0x1000adefc 0x1000adca4 0x1000e73d8 0x1000e7368 0x1000e6700 0x1000e643c 0x10005a254 0x10003cebc 0x10003c214 0x10003966c 0x100039b18 0x187d069c0 0x187f36184 0x187f3a5f0 0x187f37764 0x1844d37ac 0x1844d3618 0x1844d39c8 0x182ae909c 0x182ae8b30 0x182ae6830 0x182a10c50 0x187cff94c 0x187cfa088 0x10003bee0 0x1825ae8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
I can see that this problem is printed here in the code but I am a beginner at best in native iOS development and don't know how to fix this problem.
Please help me in fixing this problem. Thanks!
Code in AppDelegate.swift file
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
// let jsCodeLocation = NSURL(string: "http://localhost:8081/index.ios.bundle?platform=ios&dev=true")
/**
* OPTION 2
* Load from pre-bundled file on disk. The static bundle is automatically
* generated by "Bundle React Native code and images" build step.
*/
let jsCodeLocation = NSBundle.mainBundle().URLForResource("main", withExtension: "jsbundle")
As you can see, I have commented out Option 1 and uncommented out 'Option 2`. I have run the same app this way on the device like 100 times. I have not made any changes to the code but all of a sudden I started to see the error above.

Just to add a quick "doh" moment for me. If you're running in the simulator and get this, make sure the package manager is running when you run your app. If it's not, it could complain about this.

You can also get this error if you are not signing the app correctly. Check the Xcode settings and warnings

For my case, I turn on the web proxy settings on my mac which causes the problem. Turning off web proxy settings resolves my problem.

Related

'NSInternalInconsistencyException', reason: 'Couldn't posix_spawn: error 13' Swift

I'm making an iOS app for jailbroken devices running iOS 12 with Swift.
Recently I made a question, which I answered myself, in which I asked for a way to run command line tasks with Swift in iOS.
But as you can see, I'm not done yet as I'm able to use NSTask, but it crashes while running the app.
Basically, I have a NSTask.h file that allows me to use NSTask with Swift.
So, to launch a task I made the following function:
func task(launchPath: String, arguments: String...) {
let task = NSTask.init()
task?.setLaunchPath(launchPath)
task?.arguments = arguments
// Create a Pipe and make the task
// put all the output there
let pipe = Pipe()
task?.standardOutput = pipe
// Launch the task
task?.launch()
task?.waitUntilExit()
}
And call the function like this:
task(launchPath: "/usr/bin", arguments: "git clone https://github.com/lz4/lz4.git")
The problem is that when I run the app, it crashes and prints the following error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't posix_spawn: error 13'
What can I do to fix this error?
Thanks in advance.
EDIT: By the way, I forgot to mention I access the NSTask.h file using Bridging Headers.
The launch path must be the full path of the executable, not the directory containing the executable. Also the command arguments should be provided as separate arguments, not as one string. (Note that there is no shell involved which parses the command and separates the arguments before starting the process.) Therefore the call should be something like
task(launchPath: "/usr/bin/git", arguments: "clone", "https://github.com/lz4/lz4.git")

App crashing "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)"

So, after 1 hour of googling I still can't fix this error that I got. Whats happening is that every time I go to click my "Sign Up" button, the app crashes, its suppose to redirect me to a different view where the user can sign up with there email and password. I tried many things other users have posted but none of them seem to be working.
error code:
2016-11-14 23:30:52.363967 FHCI[4785:1536750] [Firebase/Core][I-COR000019] Clearcut post completed.
2016-11-14 23:30:52.364 FHCI[4785] <Debug> [Firebase/Core][I-COR000019] Clearcut post completed.
2016-11-14 23:30:53.561590 FHCI[4785:1536709] *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'Default app has already been configured.'
*** First throw call stack:
(0x186e4a1c0 0x18588455c 0x186e4a108 0x100107358 0x100107120 0x1000a795c 0x1000a7a40 0x18cca50b0 0x18cca4c78 0x18d668ae4 0x18cfefb08 0x18cff72c4 0x18d010d04 0x18d013e5c 0x18cd97b54 0x18d464b9c 0x18d465d84 0x18d465b8c 0x18d465e5c 0x18ccda484 0x18ccda404 0x18ccc48b8 0x18ccd9cf0 0x18ccd9818 0x18ccd4a60 0x18cca552c 0x18d492a54 0x18d48c4bc 0x186df8278 0x186df7bc0 0x186df57c0 0x186d24048 0x1887aa198 0x18cd102fc 0x18cd0b034 0x1000aa388 0x185d085b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Picture of my code
Story board
Earlier, I have faced the same issue. Fix it by below solutions.
Solution:1
Please make sure FIRApp.configure() the statement executes once
throughout the project. If you have written more then one time then
you have to remove your second unused statement. It will solve your
problem.
Solution:2
1 ) Remove pod file from project (How to remove pod file)
2 ) Remove Old GoogleService-Info file from the project.
3 ) Download GoogleService-Info and add it into the project.
4 ) Add pods file Again.
5) Put the Below method in Appdelegate file.
override init() {
super.init()
FIRApp.configure()
}
I also had this problem. In my case the file GoogleService-Info.plist was not included in Copy Bundle Resources.
I have the same error the solution above didn't work for me.
Solution:
Just go to status bar of Xcode Product ⇒ clean
Image:
In my case I removed Main.storyboard but forgot to remove in from General target's settings. Removing it solved unexpected crash on app launch.

PhoneGap iOS App Icon [duplicate]

This question already has answers here:
How to add app icon within phonegap projects?
(14 answers)
Closed 9 years ago.
So I'm trying to specify my custom iOS icons for my app in my config.xml file, using the guide at https://build.phonegap.com/docs/config-xml
However, when I use the line of code they give you, the app fails to load, and throws an error in XCode;
2013-07-24 09:32:06.121 iLens[19852:c07] *** Assertion failure in -[CDVConfigParser parser:parseErrorOccurred:], /Applications/MAMP/htdocs/carlzeiss/phonegap-2.9.0/iLens/CordovaLib/Classes/CDVConfigParser.m:93
2013-07-24 09:32:06.121 iLens[19852:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'config.xml parse error line 38 col 40'
*** First throw call stack:
(0x173012 0x28eee7e 0x172e78 0x1564665 0x7a352 0x15aca08 0x58e02af 0x58fa745 0x590225a 0x59044e5 0x5903f07 0x15ac8fe 0x15ac890 0x15acb46 0x15acbfa 0x590d2 0x57ea0 0x57f6e 0x83749 0x48de1e 0x5802e 0x837ad 0x8326b 0x3ac157 0x3ac747 0x3ad94b 0x3becb5 0x3bfbeb 0x3b1698 0x3720df9 0x3720ad0 0xe8bf5 0xe8962 0x119bb6 0x118f44 0x118e1b 0x3ad17a 0x3aeffc 0x82f4c 0x82ea9)
libc++abi.dylib: terminate called throwing an exception
If I remove the gap:platform="ios" part, the app loads, but the icon doesn't change.
Does anyone have a working example of changing icons through the config.xml file please?
Note: I don't believe this is a duplicate of the question that has been linked to this question. My question is in regards to adding icons through the config.xml file, as you should be able to do as per the PhoneGap documents. However, it turns out that they didn't support this option at that time.
Open Your project in Xcode and place App Icon it will work.

Integration and Use of W3i iOS Advertiser SDK to advertise our iOS app

I'm integrating W3i Advertiser SDK in iOS app, but app is being crashed at following line.
[[W3iAdvertiserSdk sharedConnector] connectWithAppID:W3I_APP_ID];
and here is exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI W3iPublisherJSONRepresentation]: unrecognized selector sent to instance 0xa1d7520'
*** First throw call stack:
(0x29d3012 0x23fae7e 0x2a5e4bd 0x29c2bbc 0x29c294e 0x16af7a 0x3e25 0xcd57b7 0xcd5da7 0xcd6fab 0xce8315 0xce924b 0xcdacf8 0x2903df9 0x2903ad0 0x2948bf5 0x2948962 0x2979bb6 0x2978f44 0x2978e1b 0xcd67da 0xcd865c 0x2d08d 0x26c5)
libc++abi.dylib: terminate called throwing an exception
I Searched a lot but there is no information on net related to w3i's integration and it's use except w3i's official guideline.
https://associate.w3i.com/integration/W3i_iOS_Advertiser_SDK_Integration_Guide1.htm
https://associate.w3i.com/integration/index.html
Here are steps i'm following:
Step1: Download SDK from W3i
Step2: Drag W3iAdvertiserSdk-3.2.0 folder into project's file folder
Step3 Add a link to the following frameworks if not already present:
AdSupport.framework
UIKit.framework
Foundation.framework
CoreGraphics.framework
Step4: Add to your AppDelegate.m file, #import "W3iAdvertiserSdk.h"
If I run the app after above Integration then app runs fine without any error but when i call the method of W3iAdvertiser to connect with app then it it throws exception which i've already posted above.
// add this line to application's didFinishLaunchingWithOptions method
[[W3iAdvertiserSdk sharedConnector] connectWithAppID:W3I_APP_ID]; //appId created at w3i
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI W3iPublisherJSONRepresentation]: unrecognized selector sent to instance 0xa1d7520'
*** First throw call stack:
(0x29d3012 0x23fae7e 0x2a5e4bd 0x29c2bbc 0x29c294e 0x16af7a 0x3e25 0xcd57b7 0xcd5da7 0xcd6fab 0xce8315 0xce924b 0xcdacf8 0x2903df9 0x2903ad0 0x2948bf5 0x2948962 0x2979bb6 0x2978f44 0x2978e1b 0xcd67da 0xcd865c 0x2d08d 0x26c5)
libc++abi.dylib: terminate called throwing an exception
Can anyone please guide me where i'm going wrong, how to use SDK's functions to connect App with w3i's to advertise our app through w3i ?
You need to follow this step as well:
Add -ObjC to Other Linker Flags in your target's Build Settings. That will allow "Option 1" to not crash.
There are two ways to connect app with w3i:
Option1: Integrate W3i-iOS-SDK, and call it's method "connectWithAppId" at start of application.
Option2: Call W3i "appWasRun" API at start of application
first option didn't work for me, but Option2 is quite easy and working fine.
Here is format of API and it's parameters:
http://api.w3i.com/PublicServices/MobileTrackingApiRestV1.svc/AppWasRun?AppId={APPID}&clientIp={CLIENTIP}&iOSIDFA={advertisingIdentifier}&iOSUDID={IOSUDID}&iOSOpenUDID={IOSOpenUDID}&iOSMD5WLANMAC={iOSMD5WLANMAC}&iOSSha1HashedMac={iOSSha1HashedMac}
Request Type: GET
Required Parameters: APPID (generated by W3I) and at-least one identifier (all parameters are preferred by W3i)
I used only OpenUDID and it worked fine.
http://api.w3i.com/PublicServices/MobileTrackingApiRestV1.svc/AppWasRun?AppId=W3i_APP_ID&iOSOpenUDID=OPEN_UDID
For More Information check the following links.
https://sites.google.com/site/w3ideveloperscom/ios/iOSAFPP/advapi
https://associate.w3i.com/integration/Device_Identifiers.htm
Hope it would help others in future :)

Why am I getting this error when testing on a IPAD?

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSString stringWithUTF8String:]: NULL cString'
* First throw call stack:
(0x374ec8bf 0x362cb1e5 0x374ec7b9 0x374ec7db 0x31dade97 0x278f 0x2c2d 0x307877eb 0x307813bd 0x3074f921 0x3074f3bf 0x3074ed2d 0x36000e13 0x374c0553 0x374c04f5 0x374bf343 0x374424dd 0x374423a5 0x30780457 0x3077d743 0x2439 0x23d0)
terminate called throwing an exception
I just don't understand why it was working until 5 minutes ago testing it on the same thing and now it's not working anymore. What can I do to solve this problem? The application works fine on the simulator.
Your string cString = null..
Fill it.
Where do you get the string? One of the more common reasons for "works on Simulator but not device" is that you are reading from a file and use the wrong case -- device has case-sensitive file systems, but Macs have case-insensitive (typically).
The reason why it didn't work on the device is because I modified the database and for some reason the one on the device was the wrong one which obviously was incompatible with the new code. After I deleted the application from the Ipod and then ran it again it worked just fine.
The reason why I had that specific error is because some variables that were holding database columns were empty.

Resources