Use of undeclared identifier 'UnityCurrentMTLCommandEncoder' - ios

I'm using Toon Boom Harmony and Unity (2017.2), when i build to iOS 11.1 using xcode i get the following error:
Use of undeclared identifier 'UnityCurrentMTLCommandEncoder'
Use of undeclared identifier 'UnityEndCurrentMTLCommandEncoder'
static int registerCallbacks()
{
HarmonySetGetMetalBundleFunc(&UnityGetMetalBundle);
HarmonySetGetMetalDeviceFunc(&UnityGetMetalDevice);
HarmonySetCurrentMTLCommandEncoderFunc(&UnityCurrentMTLCommandEncoder); // Error
HarmySetEndCurrentMTLCommandEncoder(&UnityCurrentEndMTLCommandEncoder); // Error
HarmonySetCurrentMTLCommandBufferFunc(&UnityCurrentMTLCommandBuffer);
HarmonySetGetMetalCommandQueueFunc(&UnityGetMetalCommandQueue);
return 0;
}
Thanks in advance!

Maybe the framework you are using is not swift 4 compatible.

Related

Cannot implement Swift SSLCreateContext

I am new to iOS development, and am trying to implement an SSL connection to a custom port.
I found the code from this answer as the best/easiest implementation of a secure connection over a socket https://stackoverflow.com/a/30733961/2306428
However, I am getting these errors:
Use of unresolved identifier 'kSSLClientSide'
Use of unresolved identifier 'kSSLStreamType'
Use of unresolved identifier 'kSSLSessionOptionBreakOnClientAuth'
I have checked and I am running Swift version 2.1.1, using iOS 9.2 SDK and Xcode 7.2. I have even tried adding import Security but that has no effect.
What is the reason that these constants are not being found?
The line being tested is here: https://github.com/ksred/bank-ios/blob/master/Bank/TCPClient.swift#L209
Please use the identifiers declared in Swift:
if let sslContext = SSLCreateContext(kCFAllocatorDefault, SSLProtocolSide.ClientSide, SSLConnectionType.StreamType) {
SSLSetIOFuncs(sslContext, sslReadCallback, sslWriteCallback)
SSLSetConnection(sslContext, &socketfd)
SSLSetSessionOption(sslContext, SSLSessionOption.BreakOnClientAuth, true)
SSLHandshake(sslContext)
}

swift raise unresolved identifier

I am using 3rd party external framework in my objective-c project. I created an swift file in this project to use the framework.
In MyModule-Bridging-Header.h I have import external framework header
#import “ext-service/ext-service.h”
In the ext-service.h there is an constant:
typedef NS_ENUM(NSInteger, service_err_t) {
SERVICE_SUCCESS = 1
}
In my swift code
//Compiler error: use of unresolved identifier ‘SERVICE_SUCCESS’
if result == SERVICE_SUCCESS{
NSLog(“successful!”)
}
But I get compiler error:
use of unresolved identifier ‘SERVICE_SUCCESS’
Why?
The reason to the error you mentioned is SERVICE_SUCESS is unavailable(unknown).
There are 2 possible solutions:
Use service_err_t.SERVICE_SUCCESS instead of SERVICE_SUCESS
result is of type service_err_t then just using .SERVICE_SUCESS
Hope this helps!

Apportable> AVAudioSessionPortOverrideSpeaker> Undeclared Identifier Error

I am trying my first build for android using Apportable, from a simple iOS app. Getting the following error:
use of undeclared identifier 'AVAudioSessionPortOverrideSpeaker'
The code in my iOS app is as following:
if([session respondsToSelector:#selector(overrideOutputAudioPort:error:)])
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&setOverrideError];
Can somebody guide me how I should change my objective C code to make it work with Apportable?
you forget to import module
#import AVFoundation;

Thrift in objective-c

I have a .m and .h file that generated with Thrift for objective-c based on this link :
http://wiki.apache.org/thrift/ThriftUsageObjectiveC
but there are a lot of error in .m files like :
1. error: duplicate interface definition for class
2. reimplementation of class 'bitlit_thrift_detect_cover_args'
3. use of undeclared identifier '__claim_id'; did you mean 'claim_id'?
4. use of undeclared identifier '__claim_id_isset'
5. reference to local variable 'claim_id' declared in enclosing context
6. error: use of undeclared identifier '__claim_id_isset'
__claim_id_isset = YES;
.....
7. fatal error: too many errors emitted, stopping now [-ferror-limit=]
would you please give me some hints, what is the problem?, is the error related to the xcode setting? my xCode Version is Version 4.6.1
Thanks in advance!
Here is the errors Picture:

xcode4 parameter of incompatible type

A project that runs fine on Xcode3, fails to compile on Xcode4 with this error:
file://localhost/users/Ishaq/Projects/game01/libs/cocos2d/CCLayer.m:
error: Semantic Issue: Sending 'ccColor4B' (aka 'struct _ccColor4B')
to parameter of incompatible type 'CIColor *'
the code that throws this error is below (from cocos2d-iphone CCLayer.m):
+ (id) layerWithColor:(ccColor4B)color
{
return [[[self alloc] initWithColor:color] autorelease];
}
Somehow Xcode thinks this code is calling - (id)initWithColor:(CIColor *)color; of CIImage (inside CIImage.h). How can I set Xcode's brain straight? ;-)
I've got the same problem. My resolution was to explicitly cast it proper type which helps the compiler to find the proper class. So the code looks like this:
return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
You could change self to the actual classname CCLayer which should point Xcode in the right direction.
The same thing happened for me when using the "LLVM GCC 4.2" compiler. Changing the compiler setting to "Apple LLVM Compiler 3.0" fixed it.

Resources