Skip to content

Commit f55e7ff

Browse files
authored
Example project fixes (#96)
1 parent 4a9022d commit f55e7ff

File tree

11 files changed

+123
-58
lines changed

11 files changed

+123
-58
lines changed

example/App.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const App = () => {
3333
const [permissions, setPermissions] = useState({});
3434

3535
useEffect(() => {
36-
PushNotificationIOS.requestPermissions();
3736
PushNotificationIOS.addEventListener('register', onRegistered);
3837
PushNotificationIOS.addEventListener(
3938
'registrationError',
@@ -44,6 +43,16 @@ export const App = () => {
4443
'localNotification',
4544
onLocalNotification,
4645
);
46+
47+
PushNotificationIOS.requestPermissions().then(
48+
data => {
49+
console.log('PushNotificationIOS.requestPermissions', data);
50+
},
51+
data => {
52+
console.log('PushNotificationIOS.requestPermissions failed', data);
53+
},
54+
);
55+
4756
return () => {
4857
PushNotificationIOS.removeEventListener('register', onRegistered);
4958
PushNotificationIOS.removeEventListener(

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ target 'example' do
3434
pod 'DoubleConversion', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/DoubleConversion.podspec"
3535
pod 'glog', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/glog.podspec"
3636
pod 'Folly', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/Folly.podspec"
37-
pod 'RNCPushNotificationIOS', :podspec => "../../RNCPushNotificationIOS.podspec"
37+
pod 'RNCPushNotificationIOS', :path => "../../"
3838

3939
target 'exampleTests' do
4040
inherit! :search_paths

example/ios/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ PODS:
217217
- React-cxxreact (= 0.61.5)
218218
- React-jsi (= 0.61.5)
219219
- ReactCommon/jscallinvoker (= 0.61.5)
220-
- RNCPushNotificationIOS (1.0.7):
220+
- RNCPushNotificationIOS (1.1.1):
221221
- React
222222
- Yoga (1.14.0)
223223

@@ -249,7 +249,7 @@ DEPENDENCIES:
249249
- React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`)
250250
- ReactCommon/jscallinvoker (from `../../node_modules/react-native/ReactCommon`)
251251
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
252-
- RNCPushNotificationIOS (from `../../RNCPushNotificationIOS.podspec`)
252+
- RNCPushNotificationIOS (from `../../`)
253253
- Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
254254

255255
SPEC REPOS:
@@ -306,7 +306,7 @@ EXTERNAL SOURCES:
306306
ReactCommon:
307307
:path: "../../node_modules/react-native/ReactCommon"
308308
RNCPushNotificationIOS:
309-
:podspec: "../../RNCPushNotificationIOS.podspec"
309+
:path: "../../"
310310
Yoga:
311311
:path: "../../node_modules/react-native/ReactCommon/yoga"
312312

@@ -336,9 +336,9 @@ SPEC CHECKSUMS:
336336
React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe
337337
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
338338
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
339-
RNCPushNotificationIOS: eea954fa69537d4a8db898fe1b1a06e2b7e15841
339+
RNCPushNotificationIOS: a0b6894f4ad9b93d9dac467fdf4d055660ac8a0d
340340
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
341341

342-
PODFILE CHECKSUM: 0eec3d6f93caee9d49875394b0b3b4beac7f7548
342+
PODFILE CHECKSUM: 86da3041baf50e3a45b63907fdf8bb3e1a6ad95a
343343

344-
COCOAPODS: 1.8.4
344+
COCOAPODS: 1.8.3

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
2D02E4901E0B4A5D006451C7 /* example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
6060
3F85BB085CA785A85936BC93 /* Pods-example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS.release.xcconfig"; path = "Target Support Files/Pods-example-tvOS/Pods-example-tvOS.release.xcconfig"; sourceTree = "<group>"; };
6161
5BA977284AE2212EF9829344 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
62+
75D14BB724349AA900E7B541 /* exampleDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleDebug.entitlements; path = example/exampleDebug.entitlements; sourceTree = "<group>"; };
63+
75D14BB824349DF600E7B541 /* exampleRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleRelease.entitlements; path = example/exampleRelease.entitlements; sourceTree = "<group>"; };
6264
7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.debug.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.debug.xcconfig"; sourceTree = "<group>"; };
6365
A34583DBF473F8BF312C0413 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
6466
A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.release.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.release.xcconfig"; sourceTree = "<group>"; };
@@ -125,6 +127,8 @@
125127
13B07FAE1A68108700A75B9A /* example */ = {
126128
isa = PBXGroup;
127129
children = (
130+
75D14BB824349DF600E7B541 /* exampleRelease.entitlements */,
131+
75D14BB724349AA900E7B541 /* exampleDebug.entitlements */,
128132
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
129133
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
130134
13B07FB01A68108700A75B9A /* AppDelegate.m */,
@@ -161,7 +165,6 @@
161165
7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */,
162166
A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */,
163167
);
164-
name = Pods;
165168
path = Pods;
166169
sourceTree = "<group>";
167170
};
@@ -285,13 +288,17 @@
285288
83CBB9F71A601CBA00E9B192 /* Project object */ = {
286289
isa = PBXProject;
287290
attributes = {
288-
LastUpgradeCheck = 0940;
291+
LastUpgradeCheck = 1130;
289292
ORGANIZATIONNAME = Facebook;
290293
TargetAttributes = {
291294
00E356ED1AD99517003FC87E = {
292295
CreatedOnToolsVersion = 6.2;
296+
ProvisioningStyle = Automatic;
293297
TestTargetID = 13B07F861A680F5B00A75B9A;
294298
};
299+
13B07F861A680F5B00A75B9A = {
300+
ProvisioningStyle = Automatic;
301+
};
295302
2D02E47A1E0B4A5D006451C7 = {
296303
CreatedOnToolsVersion = 8.2.1;
297304
ProvisioningStyle = Automatic;
@@ -305,7 +312,7 @@
305312
};
306313
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */;
307314
compatibilityVersion = "Xcode 3.2";
308-
developmentRegion = English;
315+
developmentRegion = en;
309316
hasScannedForEncodings = 0;
310317
knownRegions = (
311318
en,
@@ -583,6 +590,9 @@
583590
baseConfigurationReference = 7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */;
584591
buildSettings = {
585592
BUNDLE_LOADER = "$(TEST_HOST)";
593+
CODE_SIGN_IDENTITY = "Apple Development";
594+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
595+
CODE_SIGN_STYLE = Automatic;
586596
GCC_PREPROCESSOR_DEFINITIONS = (
587597
"DEBUG=1",
588598
"$(inherited)",
@@ -597,6 +607,8 @@
597607
);
598608
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
599609
PRODUCT_NAME = "$(TARGET_NAME)";
610+
PROVISIONING_PROFILE_SPECIFIER = "";
611+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
600612
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
601613
};
602614
name = Debug;
@@ -606,6 +618,9 @@
606618
baseConfigurationReference = A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */;
607619
buildSettings = {
608620
BUNDLE_LOADER = "$(TEST_HOST)";
621+
CODE_SIGN_IDENTITY = "Apple Development";
622+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
623+
CODE_SIGN_STYLE = Automatic;
609624
COPY_PHASE_STRIP = NO;
610625
INFOPLIST_FILE = exampleTests/Info.plist;
611626
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@@ -617,6 +632,8 @@
617632
);
618633
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
619634
PRODUCT_NAME = "$(TARGET_NAME)";
635+
PROVISIONING_PROFILE_SPECIFIER = "";
636+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
620637
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
621638
};
622639
name = Release;
@@ -626,17 +643,22 @@
626643
baseConfigurationReference = A34583DBF473F8BF312C0413 /* Pods-example.debug.xcconfig */;
627644
buildSettings = {
628645
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
646+
CODE_SIGN_ENTITLEMENTS = example/exampleDebug.entitlements;
647+
CODE_SIGN_IDENTITY = "Apple Development";
648+
CODE_SIGN_STYLE = Automatic;
629649
CURRENT_PROJECT_VERSION = 1;
630650
DEAD_CODE_STRIPPING = NO;
631651
INFOPLIST_FILE = example/Info.plist;
652+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
632653
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
633654
OTHER_LDFLAGS = (
634655
"$(inherited)",
635656
"-ObjC",
636657
"-lc++",
637658
);
638-
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
659+
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.example.push-ios-example";
639660
PRODUCT_NAME = example;
661+
PROVISIONING_PROFILE_SPECIFIER = "";
640662
VERSIONING_SYSTEM = "apple-generic";
641663
};
642664
name = Debug;
@@ -646,16 +668,21 @@
646668
baseConfigurationReference = 5BA977284AE2212EF9829344 /* Pods-example.release.xcconfig */;
647669
buildSettings = {
648670
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
671+
CODE_SIGN_ENTITLEMENTS = example/exampleRelease.entitlements;
672+
CODE_SIGN_IDENTITY = "Apple Development";
673+
CODE_SIGN_STYLE = Automatic;
649674
CURRENT_PROJECT_VERSION = 1;
650675
INFOPLIST_FILE = example/Info.plist;
676+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
651677
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
652678
OTHER_LDFLAGS = (
653679
"$(inherited)",
654680
"-ObjC",
655681
"-lc++",
656682
);
657-
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
683+
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.example.push-ios-example";
658684
PRODUCT_NAME = example;
685+
PROVISIONING_PROFILE_SPECIFIER = "";
659686
VERSIONING_SYSTEM = "apple-generic";
660687
};
661688
name = Release;
@@ -774,6 +801,7 @@
774801
isa = XCBuildConfiguration;
775802
buildSettings = {
776803
ALWAYS_SEARCH_USER_PATHS = NO;
804+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
777805
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
778806
CLANG_CXX_LIBRARY = "libc++";
779807
CLANG_ENABLE_MODULES = YES;
@@ -827,6 +855,7 @@
827855
isa = XCBuildConfiguration;
828856
buildSettings = {
829857
ALWAYS_SEARCH_USER_PATHS = NO;
858+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
830859
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
831860
CLANG_CXX_LIBRARY = "libc++";
832861
CLANG_ENABLE_MODULES = YES;

example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"
@@ -55,6 +55,15 @@
5555
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5656
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
5757
shouldUseLaunchSchemeArgsEnv = "YES">
58+
<MacroExpansion>
59+
<BuildableReference
60+
BuildableIdentifier = "primary"
61+
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
62+
BuildableName = "example-tvOS.app"
63+
BlueprintName = "example-tvOS"
64+
ReferencedContainer = "container:example.xcodeproj">
65+
</BuildableReference>
66+
</MacroExpansion>
5867
<Testables>
5968
<TestableReference
6069
skipped = "NO">
@@ -67,17 +76,6 @@
6776
</BuildableReference>
6877
</TestableReference>
6978
</Testables>
70-
<MacroExpansion>
71-
<BuildableReference
72-
BuildableIdentifier = "primary"
73-
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74-
BuildableName = "example-tvOS.app"
75-
BlueprintName = "example-tvOS"
76-
ReferencedContainer = "container:example.xcodeproj">
77-
</BuildableReference>
78-
</MacroExpansion>
79-
<AdditionalOptions>
80-
</AdditionalOptions>
8179
</TestAction>
8280
<LaunchAction
8381
buildConfiguration = "Debug"
@@ -99,8 +97,6 @@
9997
ReferencedContainer = "container:example.xcodeproj">
10098
</BuildableReference>
10199
</BuildableProductRunnable>
102-
<AdditionalOptions>
103-
</AdditionalOptions>
104100
</LaunchAction>
105101
<ProfileAction
106102
buildConfiguration = "Release"

example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1130"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "NO"
@@ -55,6 +55,15 @@
5555
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5656
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
5757
shouldUseLaunchSchemeArgsEnv = "YES">
58+
<MacroExpansion>
59+
<BuildableReference
60+
BuildableIdentifier = "primary"
61+
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
62+
BuildableName = "example.app"
63+
BlueprintName = "example"
64+
ReferencedContainer = "container:example.xcodeproj">
65+
</BuildableReference>
66+
</MacroExpansion>
5867
<Testables>
5968
<TestableReference
6069
skipped = "NO">
@@ -67,17 +76,6 @@
6776
</BuildableReference>
6877
</TestableReference>
6978
</Testables>
70-
<MacroExpansion>
71-
<BuildableReference
72-
BuildableIdentifier = "primary"
73-
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74-
BuildableName = "example.app"
75-
BlueprintName = "example"
76-
ReferencedContainer = "container:example.xcodeproj">
77-
</BuildableReference>
78-
</MacroExpansion>
79-
<AdditionalOptions>
80-
</AdditionalOptions>
8179
</TestAction>
8280
<LaunchAction
8381
buildConfiguration = "Debug"
@@ -99,8 +97,6 @@
9997
ReferencedContainer = "container:example.xcodeproj">
10098
</BuildableReference>
10199
</BuildableProductRunnable>
102-
<AdditionalOptions>
103-
</AdditionalOptions>
104100
</LaunchAction>
105101
<ProfileAction
106102
buildConfiguration = "Release"

example/ios/example/AppDelegate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#import <UserNotifications/UNUserNotificationCenter.h>
89
#import <React/RCTBridgeDelegate.h>
910
#import <UIKit/UIKit.h>
1011

11-
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
12-
12+
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
1313
@property (nonatomic, strong) UIWindow *window;
1414

1515
@end

0 commit comments

Comments
 (0)