alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
765 stars 401 forks source link

Exception: Module AppRegistry is not a registered callable module (calling runApplication) #28

Open timoschlueter opened 7 years ago

timoschlueter commented 7 years ago

Hi everyone,

i am having trouble setting up the module for my iOS app.

I added a Share Extension to my existing app project through Xcode by applying all the steps from the Readme. I ended up with a "index.ios.js" file where i added the additional registerComponent() call for the extension (imported as "Share", i used the share.ios.js from the example). The Extension itself is called "ShareExt" in the "ShareExt.m"-Obj-C-file, my main App is called "QRSticker" and still works when started with react-native run-ios.

Here are the parts i added to my index.ios.js file:

AppRegistry.registerComponent('QRSticker', () => QRSticker);
AppRegistry.registerComponent('ShareExt', () => Share);

The main app still works fine as it has for a while. The extension however does not seem to be working. The extension itself is visible from the share menu in the simulator, but as soon as i touch the icon, the following error message occurs:

Mar 24 15:20:14 MacBook-Pro pkd[15852] : Use of NSTruePredicate is forbidden: TRUEPREDICATE Mar 24 15:20:18 MacBook-Pro com.apple.WebKit.Networking[23418] : [] nw_endpoint_handler_add_write_request [14.1 37.252.172.53:443 failed socket-flow (satisfied)] cannot accept write requests Mar 24 15:20:18 MacBook-Pro com.apple.WebKit.Networking[23418] : [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument Mar 24 15:20:26 MacBook-Pro logd[15811] : metadata shared cached uuid is null (using logd's shared cache info) ShareExt (23420) Mar 24 15:20:26 MacBook-Pro logd[15811] : Failed to harvest strings for pathless uuid '00000000-0000-0000-0000-000000000000' Mar 24 15:20:26 MacBook-Pro com.apple.CoreSimulator.SimDevice.29252BE3-88F8-42FE-B09E-D6681A92EA79.launchd_sim[15800] (com.apple.imfoundation.IMRemoteURLConnectionAgent) : Unknown key for integer: _DirtyJetsamMemoryLimit Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Failed to inherit CoreMedia permissions from 23417: (null) Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Initializing <RCTBatchedBridge: 0x6000001a41a0> (parent: <RCTBridge: 0x6080000d47b0>, executor: RCTJSCExecutor) Mar 24 15:20:26 MacBook-Pro backboardd[15818] : [Common] Unable to bootstrap_look_up port with name in.timo.ios.QRSticker.ShareExt.gsEvents: unknown error code (1102) Mar 24 15:20:26 MacBook-Pro SpringBoard[15817] : [KeyboardArbiter] HW kbd: Failed to set in.timo.ios.QRSticker.ShareExt as keyboard focus Mar 24 15:20:26 MacBook-Pro SpringBoard[15817] : [KeyboardArbiter] [_UIKeyboardArbiter] Rejecting attach for <_UIKeyboardArbiterHandle: 0x6180006f4280; PID 23417: com.apple.mobilesafari ; hosting PIDs {( 23420 )}; level 0.000000; active NO [wants YES]; suppression 0> (currently (null)) Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : [] __nw_connection_get_connected_socket_block_invoke 4 Connection has no connected handler Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Sending websocketFailed with no listeners registered. Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular') Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Unhandled JS Exception: undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular') Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Running application ShareExt ({ initialProps = { }; rootTag = 1; }) Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Module AppRegistry is not a registered callable module (calling runApplication) Mar 24 15:20:26 MacBook-Pro ShareExt[23420] : Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication) Mar 24 15:20:27 MacBook-Pro ShareExt[23420] : -[NSNull integerValue]: unrecognized selector sent to instance 0x10f86c130 Mar 24 15:20:27 MacBook-Pro ShareExt[23420] : Exception '-[NSNull integerValue]: unrecognized selector sent to instance 0x10f86c130' was thrown while invoking updateExceptionMessage on target ExceptionsManager with params ( "undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')",

The error that caught my attention is "Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)". That doesn't seem to be right. Since the Xcode-Part of the setup seems to work, i guess my React setup is the problem.

I am launching the app with react-native run-ios, go back to the Homescreen and then try to launch the Share Extension from the Mobile Safari.

Can someone point me in the right direction? :)

alinz commented 7 years ago

@timoschlueter in order to see the problem and do proper debugging in xcode by placing break point, please refer to this https://github.com/alinz/react-native-share-extension/issues/18#issuecomment-278023118

use that and let me know if you find more details about it,

One other thing, can you make a simple app and add the share extension and getting that to work?