Skip to content

Commit

Permalink
Don't crash the iOS simulator when requesting Rive Renderer
Browse files Browse the repository at this point in the history
Instead, fall back on Skia with a warning.

Diffs=
e0c21beec Don't crash the iOS simulator when requesting Rive Renderer (#6110)

Co-authored-by: Chris Dalton <[email protected]>
  • Loading branch information
csmartdalton and csmartdalton committed Oct 20, 2023
1 parent c9a6137 commit 2a2bd16
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c5cde614bdb0de792c0bb074185f6ff51b1ff954
e0c21beec5fc5bbd301dfeb06231c92783f3e050
2 changes: 1 addition & 1 deletion .rive_renderer
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4922724744bcca92e465f98f80553224db7e8874
b7a4733ed176f573eafb02f9a65455c86649c1ee
2 changes: 1 addition & 1 deletion Example-iOS/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
RenderContextManager.shared().defaultRenderer = RendererType.skiaRenderer
RenderContextManager.shared().defaultRenderer = RendererType.riveRenderer
return true
}

Expand Down
4 changes: 0 additions & 4 deletions RiveRuntime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
83DE4CA02AAA072B00B88B72 /* PlatformCGImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83DE4C9F2AAA072B00B88B72 /* PlatformCGImage.mm */; };
83DE4CA22AAA077200B88B72 /* PlatformCGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DE4CA12AAA077200B88B72 /* PlatformCGImage.h */; };
83DE4CA72AAAE72100B88B72 /* RenderContext.hh in Headers */ = {isa = PBXBuildFile; fileRef = 83DE4CA62AAAE72000B88B72 /* RenderContext.hh */; };
83DE4CBA2AB4B26D00B88B72 /* AutoCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DE4CB92AB4B26D00B88B72 /* AutoCF.h */; };
C34609FC27FF9114002DBCB7 /* RiveFile+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34609FB27FF9114002DBCB7 /* RiveFile+Extensions.swift */; };
C3468E5827EB9887008652FD /* RiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3468E5727EB9887008652FD /* RiveView.swift */; };
C3468E5A27ECC7C6008652FD /* RiveViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3468E5927ECC7C6008652FD /* RiveViewModel.swift */; };
Expand Down Expand Up @@ -131,7 +130,6 @@
83DE4C9F2AAA072B00B88B72 /* PlatformCGImage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformCGImage.mm; sourceTree = "<group>"; };
83DE4CA12AAA077200B88B72 /* PlatformCGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCGImage.h; sourceTree = "<group>"; };
83DE4CA62AAAE72000B88B72 /* RenderContext.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RenderContext.hh; sourceTree = "<group>"; };
83DE4CB92AB4B26D00B88B72 /* AutoCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoCF.h; sourceTree = "<group>"; };
C34609FB27FF9114002DBCB7 /* RiveFile+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RiveFile+Extensions.swift"; sourceTree = "<group>"; };
C3468E5727EB9887008652FD /* RiveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RiveView.swift; sourceTree = "<group>"; };
C3468E5927ECC7C6008652FD /* RiveViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RiveViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -180,7 +178,6 @@
046FB801264EB632000129B1 /* include */ = {
isa = PBXGroup;
children = (
83DE4CB92AB4B26D00B88B72 /* AutoCF.h */,
83DE4CA12AAA077200B88B72 /* PlatformCGImage.h */,
C9C741F224FC510200EF9516 /* Rive.h */,
046FB7E7264EAA5F000129B1 /* RiveFile.h */,
Expand Down Expand Up @@ -323,7 +320,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
83DE4CBA2AB4B26D00B88B72 /* AutoCF.h in Headers */,
046FB7F7264EAA60000129B1 /* RiveFile.h in Headers */,
046FB7FC264EAA61000129B1 /* RiveArtboard.h in Headers */,
2A7079352726277C00C035A1 /* rive_renderer_view.hh in Headers */,
Expand Down
6 changes: 6 additions & 0 deletions Source/Renderer/RenderContextManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,13 @@ - (RenderContext*)getDefaultContext
case RendererType::skiaRenderer:
return [self getSkiaContext];
case RendererType::riveRenderer:
#if TARGET_OS_SIMULATOR
NSLog(@"warning: Rive Renderer is not supported by the simulator. Falling back on Skia "
@"within the simulator.");
return [self getSkiaContext];
#else
return [self getRiveRendererContext];
#endif
case RendererType::cgRenderer:
return [self getCGRendererContext];
}
Expand Down

0 comments on commit 2a2bd16

Please sign in to comment.