Skip to content

Commit

Permalink
fix: retain instance on init
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Mar 7, 2022
1 parent dddc242 commit 2d6f455
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion AppWithModules/Source Files/main.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <NativeScript/NativeScript.h>

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

int main(int argc, char *argv[]) {
@autoreleasepool {
Expand All @@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
config.ArgumentsCount = argc;
config.Arguments = argv;

[[NativeScript alloc] initWithConfig: config];
nativescript = [NativeScript alloc] initWithConfig: config];

return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion TestRunner/Source Files/main.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <NativeScript/NativeScript.h>

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

int main(int argc, char *argv[]) {
@autoreleasepool {
Expand All @@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
config.ArgumentsCount = argc;
config.Arguments = argv;

[[NativeScript alloc] initWithConfig:config];
nativescript = [[NativeScript alloc] initWithConfig:config];

return 0;
}
Expand Down
5 changes: 3 additions & 2 deletions project-template/internal/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#endif

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

int main(int argc, char *argv[]) {
@autoreleasepool {
Expand All @@ -23,7 +24,7 @@ int main(int argc, char *argv[]) {
int refreshRequestSubscription;
notify_register_dispatch(NOTIFICATION("RefreshRequest"), &refreshRequestSubscription, dispatch_get_main_queue(), ^(int token) {
notify_post(NOTIFICATION("AppRefreshStarted"));
bool success = [NativeScript liveSync];
bool success = [nativescript liveSync];
if (success) {
notify_post(NOTIFICATION("AppRefreshSucceeded"));
} else {
Expand Down Expand Up @@ -55,7 +56,7 @@ int main(int argc, char *argv[]) {
config.ArgumentsCount = argc;
config.Arguments = argv;

[[NativeScript alloc] initWithConfig:config];
nativescript = [[NativeScript alloc] initWithConfig:config];

return 0;
}
Expand Down

0 comments on commit 2d6f455

Please sign in to comment.