From 16921890276bc73335f33cb436a243ff6d43d9ca Mon Sep 17 00:00:00 2001 From: Hendrik Bugdoll Date: Wed, 1 Oct 2025 10:07:18 +0200 Subject: [PATCH] fix(ios): reduced TitaniumKit build warnings --- .../TitaniumKit/Sources/API/KrollModule.m | 2 +- .../TitaniumKit/Sources/API/ScriptModule.m | 1 + iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m | 12 +++++++----- .../TitaniumKit/Sources/API/TiExceptionHandler.m | 2 +- iphone/TitaniumKit/TitaniumKit/Sources/API/TiProxy.h | 2 ++ .../TitaniumKit/TitaniumKit/Sources/API/TiUIView.m | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollModule.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollModule.m index 22a46099666..fb6bfcfc89b 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollModule.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollModule.m @@ -81,7 +81,7 @@ - (JSValue *)binding:(NSString *)moduleID // FIXME: Extract a Proxy protocol for ObjcProxy/TiProxy and place methods like boundBridge:withKrollObject: on it! if ([module isKindOfClass:[ObjcModule class]]) { - return [module JSValueInContext:context]; + return [(ObjcModule *)module JSValueInContext:context]; } KrollObject *ko = [[self executionContext] registerProxy:module]; // This basically retains the module for the lifetime of the bridge return [JSValue valueWithJSValueRef:[ko jsobject] inContext:context]; diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/ScriptModule.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/ScriptModule.m index 60546957faf..049f4f1195f 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/ScriptModule.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/ScriptModule.m @@ -8,6 +8,7 @@ #import "KrollBridge.h" #import "KrollContext.h" #import "TiExceptionHandler.h" +#import "TiHost.h" @implementation ScriptModule diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m index cd3370bcf8a..a6eb10856e0 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiBlob.m @@ -341,6 +341,9 @@ - (BOOL)writeTo:(NSString *)destination error:(NSError **)error writeData = data; break; } + default: { + break; + } } if (writeData != nil) { return [writeData writeToFile:destination atomically:YES]; @@ -481,8 +484,7 @@ - (JSValue *)toArrayBuffer // Now make an ArrayBuffer with the copied bytes JSContext *context = JSContext.currentContext; - JSValueRef *exception; - JSObjectRef arrayBuffer = JSObjectMakeArrayBufferWithBytesNoCopy(context.JSGlobalContextRef, arrayBytes, len, jsArrayBufferFreeDeallocator, nil, exception); + JSObjectRef arrayBuffer = JSObjectMakeArrayBufferWithBytesNoCopy(context.JSGlobalContextRef, arrayBytes, len, jsArrayBufferFreeDeallocator, nil, NULL); return [JSValue valueWithJSValueRef:arrayBuffer inContext:context]; } @@ -499,9 +501,9 @@ - (JSValue *)arrayBuffer [theData getBytes:arrayBytes length:len]; // Now make an ArrayBuffer with the copied bytes - JSValueRef *exception; - JSObjectRef arrayBuffer = JSObjectMakeArrayBufferWithBytesNoCopy(context.JSGlobalContextRef, arrayBytes, len, jsArrayBufferFreeDeallocator, nil, exception); - if (exception) { + JSValueRef exception = NULL; + JSObjectRef arrayBuffer = JSObjectMakeArrayBufferWithBytesNoCopy(context.JSGlobalContextRef, arrayBytes, len, jsArrayBufferFreeDeallocator, nil, &exception); + if (exception != NULL) { [promise reject:@[ [JSValue valueWithJSValueRef:exception inContext:context] ]]; } else { JSValue *buffer = [JSValue valueWithJSValueRef:arrayBuffer inContext:context]; diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.m index 3286c333704..c95ddae9a1b 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.m @@ -67,7 +67,7 @@ - (void)reportException:(NSException *)exception [currentDelegate handleUncaughtException:exception]; return; } - [prevUncaughtExceptionHandler handleUncaughtException:exception]; + [(id)prevUncaughtExceptionHandler handleUncaughtException:exception]; } - (void)reportScriptError:(TiScriptError *)scriptError diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiProxy.h b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiProxy.h index 15e6acfc2d8..373ab591736 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiProxy.h +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiProxy.h @@ -306,6 +306,8 @@ void DoProxyDelegateReadValuesWithKeysFromProxy(UIView *target, - (void)fireEvent:(NSString *)type withObject:(id)obj withSource:(id)source; - (void)fireEvent:(NSString *)type withObject:(id)obj withSource:(id)source propagate:(BOOL)yn; +- (void)applyProperties:(id)args; + /** Returns a dictionary of all properties set on the proxy object. @return The dictionary containing all properties. diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m index 702b7b4a33c..e41908f000c 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m @@ -1013,7 +1013,7 @@ - (CAShapeLayer *)shadowLayer [self assignShadowPropertyFromLayer:_shadowLayer toLayer:self.layer]; [_shadowLayer removeFromSuperlayer]; RELEASE_TO_NIL(_shadowLayer); - _shadowLayer = self.layer; + _shadowLayer = (CAShapeLayer *)self.layer; } else if ((array.count > 1) && (!_shadowLayer || _shadowLayer == self.layer)) { _shadowLayer = [[CAShapeLayer alloc] init]; _shadowLayer.fillColor = UIColor.clearColor.CGColor;