Skip to content

Commit 2d6f455

Browse files
committed
fix: retain instance on init
1 parent dddc242 commit 2d6f455

File tree

3 files changed

+7
-4
lines changed
  • AppWithModules/Source Files
  • TestRunner/Source Files
  • project-template/internal

3 files changed

+7
-4
lines changed

AppWithModules/Source Files/main.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#import <NativeScript/NativeScript.h>
22

33
extern char startOfMetadataSection __asm("section$start$__DATA$__TNSMetadata");
4+
NativeScript* nativescript;
45

56
int main(int argc, char *argv[]) {
67
@autoreleasepool {
@@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
2324
config.ArgumentsCount = argc;
2425
config.Arguments = argv;
2526

26-
[[NativeScript alloc] initWithConfig: config];
27+
nativescript = [NativeScript alloc] initWithConfig: config];
2728

2829
return 0;
2930
}

TestRunner/Source Files/main.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#import <NativeScript/NativeScript.h>
22

33
extern char startOfMetadataSection __asm("section$start$__DATA$__TNSMetadata");
4+
NativeScript* nativescript;
45

56
int main(int argc, char *argv[]) {
67
@autoreleasepool {
@@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
2324
config.ArgumentsCount = argc;
2425
config.Arguments = argv;
2526

26-
[[NativeScript alloc] initWithConfig:config];
27+
nativescript = [[NativeScript alloc] initWithConfig:config];
2728

2829
return 0;
2930
}

project-template/internal/main.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#endif
1515

1616
extern char startOfMetadataSection __asm("section$start$__DATA$__TNSMetadata");
17+
NativeScript* nativescript;
1718

1819
int main(int argc, char *argv[]) {
1920
@autoreleasepool {
@@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
2324
int refreshRequestSubscription;
2425
notify_register_dispatch(NOTIFICATION("RefreshRequest"), &refreshRequestSubscription, dispatch_get_main_queue(), ^(int token) {
2526
notify_post(NOTIFICATION("AppRefreshStarted"));
26-
bool success = [NativeScript liveSync];
27+
bool success = [nativescript liveSync];
2728
if (success) {
2829
notify_post(NOTIFICATION("AppRefreshSucceeded"));
2930
} else {
@@ -55,7 +56,7 @@ int main(int argc, char *argv[]) {
5556
config.ArgumentsCount = argc;
5657
config.Arguments = argv;
5758

58-
[[NativeScript alloc] initWithConfig:config];
59+
nativescript = [[NativeScript alloc] initWithConfig:config];
5960

6061
return 0;
6162
}

0 commit comments

Comments
 (0)