Error running the initialised React Native project in Xcode - ios

After installing react-native and running the newly created Xcode project I am getting the following output:
2015-03-26 15:35:05.865 React[1427:7950] CLTilesManagerClient: initialize, sSharedTilesManagerClient
2015-03-26 15:35:05.865 React[1427:7950] CLTilesManagerClient: init
2015-03-26 15:35:05.866 React[1427:7950] CLTilesManagerClient: reconnecting, 0x7fac1b289e40
RCTJSLog> "Running application "React" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
RCTJSLog> "Error:
stack:
React_render index.ios.bundle:955
_renderValidatedComponentWithoutOwnerOrContext index.ios.bundle:16453
_renderValidatedComponent index.ios.bundle:16479
ReactCompositeComponent__renderValidatedComponent index.ios.bundle:4860
mountComponent index.ios.bundle:15913
ReactCompositeComponent_mountComponent index.ios.bundle:4860
mountComponent index.ios.bundle:4929
mountComponentIntoNode index.ios.bundle:15386
perform index.ios.bundle:5992
batchedMountComponentIntoNode index.ios.bundle:15405
perform index.ios.bundle:5992
batchedUpdates index.ios.bundle:13507
batchedUpdates index.ios.bundle:4524
renderComponent index.ios.bundle:15457
ReactMount__renderNewRootComponent index.ios.bundle:4860
render index.ios.bundle:1155
renderApplication index.ios.bundle:33797
run index.ios.bundle:33743
runApplication index.ios.bundle:33765
jsCall index.ios.bundle:7149
_callFunction index.ios.bundle:7396
applyWithGuard index.ios.bundle:877
guardReturn index.ios.bundle:7198
callFunctionReturnFlushedQueue index.ios.bundle:7405
URL: http://localhost:8081/index.ios.bundle
line: 955
message: undefined is not a function (evaluating 'React.createElement(Text, {style: styles.welcome},
"Welcome to React Native!"
)')"
Any help figuring out why this is failing would be appreciated.
Thanks!

To run on a device (which is your second problem), take a look at these comments from the React Native examples:
https://github.com/facebook/react-native/blob/master/Examples/Movies/Movies/AppDelegate.m
To run on device, change localhost to the IP address of your
computer, and make sure your computer and iOS device are on the same
Wi-Fi network.
I think this is because the application needs to connect to the packager. See if that helps.

Related

Robotframework - appium : WebDriver' object has no attribute 'w3c'

I am trying to perform scroll operation using robot framework - appium, but I end up with the error:-
WebDriver' object has no attribute 'w3c'
My code:
*** Settings ***
Library AppiumLibrary
*** Test Cases ***
test_case1
Open Application http://localhost:4723/wd/hub platformName=Android deviceName=xxx
appPackage=com.android.settings appActivity=com.android.settings.Settings
automationName=Uiautomator2
Swipe 200 300 200 100
Error observed:-
AttributeError: 'WebDriver' object has no attribute 'w3c'
Note:- Other keywords like click element etc are working fine.
Today I have the exact same error as yours. It take me more than 1 hour to figure out what happen.
The problem is the Appium_Python_Client-2.1.2 library. Try to uninstall and reinstall it. And it will fix your error.
I needed to downgrade the Appium_Python_Client to version 1.3 and that fixed my issues.
pip uninstall Appium-Python-Client
pip install "Appium-Python-Client<2"

Error: global.nativeTraceBeginSection is not a function

I didnt change anything but suddenly I got this error in my xproject and the app got stuck and thing the when I do simulator through my Xcode is working but not with physical device.
the full log is here:
'Failed to print error: ', 'global.nativeTraceBeginSection is not a function. (In \'global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName, args)\', \'global.nativeTraceBeginSection\' is undefined)'
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0910 19:37:09.077337 1871998976 JSCHelpers.cpp:137] Got JS Exception: Exception calling object as function: global.nativeTraceEndSection is not a function. (In 'global.nativeTraceEndSection(TRACE_TAG_REACT_APPS)', 'global.nativeTraceEndSection' is undefined) (<unknown file>:2303)
E0910 19:37:09.077525 1871998976 JSCHelpers.cpp:143] Got JS Stack: endEvent#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2303:35
__callFunction#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2098:24
http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:1927:29
__guard#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2068:11
callFunctionReturnFlushedQueue#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:1926:19
callFunctionReturnFlushedQueue#[native code]
2018-09-10 19:37:09.079 [fatal][tid:com.facebook.react.JavaScript] Error calling Systrace.setEnabled
Unhandled JS Exception: Exception calling object as function: global.nativeTraceEndSection is not a function. (In 'global.nativeTraceEndSection(TRACE_TAG_REACT_APPS)', 'global.nativeTraceEndSection' is undefined) (<unknown file>:2303)
2018-09-10 19:37:09.082 [error][tid:com.facebook.react.JavaScript] global.nativeTraceBeginSection is not a function. (In 'global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName, args)', 'global.nativeTraceBeginSection' is undefined)
2018-09-10 19:37:09.083 [info][tid:com.facebook.react.JavaScript] 'Failed to print error: ', 'Can\'t find variable: regeneratorRuntime'
E0910 19:37:09.086755 1871998976 JSCHelpers.cpp:137] Got JS Exception: Exception calling object as function: global.nativeTraceBeginSection is not a function. (In 'global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName, args)', 'global.nativeTraceBeginSection' is undefined) (<unknown file>:2298)
E0910 19:37:09.086828 1871998976 JSCHelpers.cpp:143] Got JS Stack: beginEvent#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2298:37
__invokeCallback#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2125:28
http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:1950:32
__guard#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:2068:11
invokeCallbackAndReturnFlushedQueue#http://192.168.1.27.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false:1949:19
invokeCallbackAndReturnFlushedQueue#[native code]
(lldb)
I have been trying to find solution, didn't succeed with any of them.
this error shows on my Xcode logged and not on my screen of the phone
Thank you so much for the help!!
I had the same issue because I unintentionally enabled Start Systrace and since it is a known react native issue... I was getting the error.
What worked for me was just disabling Start Systrace and restarting the project. How I do that?
Command ⌘ + D
Press Disable Start Systrace, that's it!
This is a known, unresolved React Native issue. There are a few workarounds in the GitHub issue, including:
Delete, and then reinstall the app from Xcode or react-native run-ios
Revert to the old bridge (instructions)
See https://github.com/facebook/react-native/issues/15003 for more details.

IBM MobileFirst Platform is not triggering Remote disable message on iOS for Hybrid app

We have a hybrid application that doesn't show the remote disable message once we change the state from "Active" to "Access Disabled" even though the app is actually getting disabled as we can't use it anymore.
worklight.properties:
wl.remoteDisable.cache.enabled=true
wl.remoteDisable.cache.refreshIntervalInSeconds=1
initOption.js (I have added console.log to see what is the error in between):
onErrorRemoteDisableDenial : function (message, downloadLink) {
console.log("onErrorRemoteDisableDenial ......... Triggered");
WL.SimpleDialog.show(
appStoreUpdateTitle,
message,
[{text: notNowButton, handler: function() {WL.App.close();}},
{text: downloadNewVersionBtn, handler: function() {WL.App.openURL(downloadLink, "_blank");}}]
);
console.log("onErrorRemoteDisableDenial ......... Endded");
},
console.log (from xCode):
2017-03-28 10:51:57.312 GRSMobile[73598:5607189] onErrorRemoteDisableDenial ......... Triggered
2017-03-28 10:51:57.315 GRSMobile[73598:5607189] Warning: Attempt to present <UIAlertController: 0x7f9e29e2c000> on <CDVViewController: 0x7f9e29dd0290> whose view is not in the window hierarchy!
2017-03-28 10:51:57.315 GRSMobile[73598:5607189] onErrorRemoteDisableDenial ......... Endded
The same code works on Android but not iOS.
IBM MobileFirst Platform Version: 7.1.0.00.20161118-2214
This behavior seems similar to APAR PI74295, which is fixed in MobileFirst Platform Foundation 7.1 builds dated 20170109-1751 (and later). I suspect the cause is the same.
I would recommend to obtain a more recent iFix build and apply it, and use that to build your application and confirm if this issue is resolved.

XCTests failing to launch app in simulator intermittently

Has anyone experienced and fixed:
XCTests are failing intermittently to launch app in the simulator for UI testing (XCUI).
I am running through fastlane, different tests appear to fail each test run.
OSX: 10.12.3
iOS simulator: 10.0
Xcode 8.2.1
Fastlane 2.11.0
Attempted to fix it by adding a 3 second sleep between setup and launch in my tests, but it still appears, maybe not as often but still...
UI Testing Failure - Failure attempting to launch
<XCUIApplicationImpl: 0x600000231b20 no.something.bb.debug at
/Users/server/Library/Developer/Xcode/DerivedData/ex-gmtcdujyggxwfrarizpgaromjfxj/Build/Products/Debug-iphonesimulator/BB.app>:
Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request
to open "no.something.bb.debug" failed."
UserInfo={NSLocalizedDescription=The request to open
"no.something.bb.debug" failed., NSLocalizedFailureReason=The request
was denied by service delegate (SBMainWorkspace) for reason: Busy
("Application "no.something.bb.debug" is installing or uninstalling,
and cannot be launched")., BSErrorCodeDescription=RequestDenied,
NSUnderlyingError=0x6080002598f0 {Error
Domain=FBSOpenApplicationErrorDomain Code=6 "Application
"no.something.bb.debug" is installing or uninstalling, and cannot be
launched." UserInfo={BSErrorCodeDescription=Busy,
NSLocalizedFailureReason=Application "no.something.bb.debug" is
installing or uninstalling, and cannot be launched.}}}
I experienced the same issue. I found out that there is a rader open for this. In the comments I found a tip that I implemented in a function that does a retry.
The arguments array is an array of enum values where the base type is String. I use that for the app arguments.
Unfortunately this is still not full prove. In my case the number of failures went down considerably, but did not go away.
var app: XCUIApplication = XCUIApplication()
public func tryLaunch<T>(_ arguments: [T], _ counter: Int = 10) where T: RawRepresentable {
sleep(3)
XCUIApplication().terminate()
sleep(3)
app = XCUIApplication()
app.launchArguments = arguments.map { $0.rawValue as! String }
app.launch()
sleep(3)
if !app.exists && counter > 0 {
tryLaunch(arguments, counter - 1)
}
}
The function above is included in https://github.com/evermeer/UITestHelper
After playing around we were observed that if we run limited test cases, this error went down considerably. You can find more details at https://blog.talentica.com/2017/04/04/use-xcode-8-with-jenkins/

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

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.

Resources