App does not appear in list of "sharable" apps
Closed this issue · 5 comments
Hey everyone,
Sorry in advance if there is a similar issue but couldn't find any.
So I followed step by step and multiple times the iOS installation instructions but I can't seem to make the share extension visible when I try to share an image to my existing app.
I'm wondering if it could be a target problem or some activation rule but I honestly really don't know at this point.
Hope you guys can help me.
Thank you!
- React Native Version -> 0.55.4
- React Native Share Extension Version -> 1.2.1
- iOS Version -> 11.3.1
@martinlavanant What exactly are you trying to share? If you are trying to share images then you have to update the activation rules like this:
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
..................
Further more check if you have activated it in your "share sheet":
Thanks for responding man,
Actually it doesn't even appear in the activities list.
Tried the installation multiple times and I really can't figure out why...
I'm going to update the extension rules and I will update this post! Thanks!
Thanks a lot, you were right, it was the NSExtension rules that prevented my app to be listed on the activities!
But now I've got a small problem, I believe my share.js component is never called, I've added a few console.logs in the constructor and lifecycle method, but they're never executed.
I took a look at some issues which I believed were the same problem, but none of the solutions worked.
Would be greatly appreciated if you could help me, I'm really struggling right now ^^
Appdelegate.m
#import <Foundation/Foundation.h>
#import "ReactNativeShareExtension.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLog.h>
@interface MyShareEx : ReactNativeShareExtension
@end
@implementation MyShareEx
RCT_EXPORT_MODULE();
- (UIView*) shareView {
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"MyShareEx"
initialProperties:nil
launchOptions:nil];
rootView.backgroundColor = nil;
// Uncomment for console output in Xcode console for release mode on device:
// RCTSetLogThreshold(RCTLogLevelInfo - 1);
return rootView;
}
@end
Share.js
import React, { Component } from 'react'
import Modal from 'react-native-modal';
import ShareExtension from 'react-native-share-extension'
import {
Text,
View,
TouchableOpacity
} from 'react-native'
export default class Share extends Component {
constructor(props, context) {
console.log('construct');
super(props, context);
this.state = {
isOpen: true,
type: '',
value: ''
}
}
async componentDidMount() {
console.log('componentdidmount');
try {
const { type, value } = await ShareExtension.data();
this.setState({
type,
value
});
console.log('TYPE', type);
console.log('VALUE', value);
} catch(e) {
console.log('errrr', e)
}
}
onClose = () => ShareExtension.close();
closing = () => this.setState({ isOpen: false });
render() {
console.log('RENDER');
return (
<View style={{flex: 1, backgroundColor: 'red'}}>
<Modal isVisible={true}>
<View style={{ flex: 1 }}>
<Text>I am the modal content!</Text>
</View>
</Modal>
</View>
);
}
}
Index.js
import { AppRegistry } from 'react-native';
import App from './App';
const Share = require('./Share').default;
AppRegistry.registerComponent('mrs', () => App);
AppRegistry.registerComponent('MyShareEx', () => Share);
Closing this issue since my problem is off topic now, Thanks for the help tho!