Comments (5)
Building and running from Xcode 13.3.1 to iOS 15.4.1 results in a black screen with no camera input. The console errors look similar to the bug reported on the Apple Developer Forums.
from nbarkit.
from nbarkit.
https://developer.apple.com/forums/thread/703735?answerId=711909022#711909022
There exist multiple hacky ways to fix this bug using Private (Apple) APIs. This one isn't super difficult to patch. I've confirmed this fixes the bug from Xcode 13.3.1 to iOS 15.4.1.
from nbarkit.
diff --git a/SwizzledDecoder.m b/SwizzledDecoder.m
new file mode 100644
index 0000000..2af4106
--- /dev/null
+++ b/SwizzledDecoder.m
@@ -0,0 +1,60 @@
+//
+// SwizzledDecoder.m
+//
+// Copyright © 2021 North Bronson Software
+//
+// This Item is protected by copyright and/or related rights. You are free to use this Item in any way that is permitted by the copyright and related rights legislation that applies to your use. In addition, no permission is required from the rights-holder(s) for scholarly, educational, or non-commercial uses. For other uses, you need to obtain permission from the rights-holder(s).
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <objc/runtime.h>
+
+@interface SwizzledDecoder : NSObject
+
+- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3;
+
+@end
+
+@implementation SwizzledDecoder
+
++ (void)load {
+ // https://nshipster.com/method-swizzling/
+
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ Class originalClass = NSClassFromString(@"NSXPCDecoder");
+ Class swizzledClass = NSClassFromString(@"SwizzledDecoder");
+
+ SEL originalSelector = @selector(_validateAllowedClass:forKey:allowingInvocations:);
+ SEL swizzledSelector = @selector(__validateAllowedClass:forKey:allowingInvocations:);
+
+ Method originalMethod = class_getInstanceMethod(originalClass, originalSelector);
+ Method swizzledMethod = class_getInstanceMethod(swizzledClass, swizzledSelector);
+
+ IMP originalImp = method_getImplementation(originalMethod);
+ IMP swizzledImp = method_getImplementation(swizzledMethod);
+
+ class_replaceMethod(originalClass,
+ swizzledSelector,
+ originalImp,
+ method_getTypeEncoding(originalMethod));
+ class_replaceMethod(originalClass,
+ originalSelector,
+ swizzledImp,
+ method_getTypeEncoding(swizzledMethod));
+ });
+}
+
+- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3 {
+ if ([arg2 isEqualToString: @"collaborationData"]) {
+ return;
+ }
+ return [self __validateAllowedClass: arg1 forKey: arg2 allowingInvocations: arg3];
+}
+
+@end
Here is a diff to git apply
to any repo that needs to fix around this issue on 15.4.x.
from nbarkit.
It looks like Apple resolved the issue in iOS 15.5 (19F77).
from nbarkit.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbarkit.