forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Ensure FlutterMain is called before interacting with the engine…
… in any way. (flutter#3383) * [iOS] Ensure FlutterMain is called before interacting with the engine in any way. * Licenses
- Loading branch information
1 parent
20bdd2f
commit 01afda4
Showing
6 changed files
with
60 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
shell/platform/darwin/ios/framework/Source/flutter_main_ios.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_MAIN_IOS_H_ | ||
#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_MAIN_IOS_H_ | ||
|
||
#include "lib/ftl/macros.h" | ||
|
||
namespace shell { | ||
|
||
/// Initializes the Flutter shell. This must be called before interacting with | ||
/// the engine in any way. It is safe to call this method multiple times. | ||
void FlutterMain(); | ||
|
||
} // namespace shell | ||
|
||
#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_MAIN_IOS_H_ |
20 changes: 20 additions & 0 deletions
20
shell/platform/darwin/ios/framework/Source/flutter_main_ios.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_main_ios.h" | ||
#include "flutter/shell/platform/darwin/common/platform_mac.h" | ||
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" | ||
|
||
namespace shell { | ||
|
||
void FlutterMain() { | ||
NSBundle* bundle = [NSBundle bundleForClass:[FlutterViewController class]]; | ||
NSString* icuDataPath = [bundle pathForResource:@"icudtl" ofType:@"dat"]; | ||
NSString* libraryName = | ||
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTLibraryPath"]; | ||
shell::PlatformMacMain(icuDataPath.UTF8String, | ||
libraryName != nil ? libraryName.UTF8String : ""); | ||
} | ||
|
||
} // namespace shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters