Semantic Issue: Cannot find the protocol declaration for ‘ARSessionDelegate’ - ios

Do anyone know the workaround for the build error on Xcode?
All suggestions are welcomed.
E.G: Impossible in that way, Possible with Objective-C, not Swift
Environment:
Swift:3.2, Xcode:9.2, Unity:2017.3.0f1, iOS:11.2.1
Condition:
I’m trying to make Native Plugin for Unity using Swift like this.
Unity C# -> Objective-C -> Swift
For now, I could access the iPhone camera roll from Unity.
The Project Name is GetDepthSample here.
Error Detail:
As soon as I add ARSessionDelegate on the class definition, I got the following error.
CameraRollSample.swift
Other Information:
GetDepthSample-Swift.h (generated automatically on Xcode) shows the following error.
GetDepthSample-Swift.h
It’s possible to jump to Definition of the protocol ARSessionDelegate.
Not only ARSessionDelegate but also MetalKit shows the similar error.
The original Unity Project
https://github.com/wapa5pow/CameraRollSample
Many thanks!

Looking at the header that you posted in the comment, it seems to me that maybe you need to include the ARKit framework in the project settings in Xcode. Although this generally tends to work automatically clearly something in your setup has that missing.

Related

Retrieving finder comment of a file in iOS application

I am trying to use the finder comment field of a file stored in the folder of my iOS application (I'm talking about local storage, not in the cloud). The function MDItemCreate that would enable me to do so easily is not available in iOS applications apparently, which must be why the build currently fails with the error warning : "Cannot find 'MDItemCreate' in scope". Apple documentation in fact states that this method is only available on MacOS.
I have tinkered with FileManager but it doesn't grant access to comments.
This topic seems related but the solution is quite opaque to me.
My understanding of Swift is rather limited, if you would be so kind as to provide a simple and detailed answer I'd be much grateful.
With thanks,
Julien
I'm not completely certain, but messages like "Cannot find 'X' in scope" are often due to a forgotten import statement. MDItemCreate(_:_:) (docs) seems to be part of the Core Services framework, which has been part of iOS since iOS 12. Have you imported the framework?
You can do this (at the top of your .swift file) as follows:
import CoreServices

Swift Extension Issues

I have a swift iOS application that uses different secp256k1 pods as well as Array, Data and other extensions.
If I build the module on its own and test everything works.
The moment I bring the module/pod into my project the tests fail.
Is there a good way to find out if the module/pod is calling the wrong Data extension? How can I tell? Is there a hierarchy I can look at?
I don't really have code as I'm not sure where the issue is and the project is very big.
So for an example, if I had a Data extension in my project, and a Data extension in a pod, which Data extension is used and how can I verify?
Thank You
EDIT:
It seems to be an issue with secp256k1, UnsafeMutablePointer and my getPointer() function.
In the module/pod its retiring a different pointer than in the application.
Any Ideas?

MITM attack reported on deprecated NSURLConnectionDelegate

I have an Objective-C project whose .ipa was tested with this tool online: https://www.immuniweb.com/mobile
It reports that my app has a high risk security issue, pointing to the canAuthenticateAgainstProtectionSpace in the NSURLConnectionDelegate protocol.
This method has been deprecated by iOS after 8.0 version. My app is not using it directly anywhere and I suppose this is not used by apple also even indirectly, since it is deprecated.
I tried a sample ipa (new project with nothing in it) with Objective-C project and the same issue came for that as well. But it did not come for a sample ipa which supported Swift. Even if this is just a warning, is there a way to fix other than just supporting Swift language only?
The tool has detected that the .h file that defines the NSURLConnectionDelegate protocol declares the canAuthenticateAgainstProtectionSpace function. This is, of course, to be expected.
It would make more sense for the tool to report implementations of the method, not simply declarations of it
Since you haven’t implemented this method you don’t need to worry about flaws in your implementation.
As for getting rid of the issue...Don’t use the tool? It doesn’t seem very good based on this.
Is there an option to tell it not to scan .h files?
TBH it seems like a bug in the tool if not any of your Libraries or Frameworks internally uses that.
In your test for the sample Objective C project it's reported as bug however for a sample swift project it's not reported Hence I guess it's more of bug from the tool side.
I would suggest you to report this issue to them.Hopefully they will get you back with some suggestions.
or
you can try some other pen-testing tools as well.

How to wrap existing iOS code in a new Appcelerator module?

This seems like a basic request, but I can't find the answer to it anywhere. I want to wrap some existing iOS code that I wrote, in a Appcelerator module. That's it. Important points:
I am NOT wrapping a pre-existing 3rd party iOS SDK.
I wrote the iOS code being wrapped.
Code is verified as working within xcode.
There are no .a files. There are 2x .h files and 2x .m files though.
There are no UI elements in the iOS code as it is only designed to connect the native bluetooth hardware to the app.
I have created a generic appcelerator iOS module project, built it, and successfully called the generic ID function within my app.
I cannot figure out how to successfully edit the generic module so that it utilizes my code. Every attempt results in it refusing to compile, and it's maddening.
I do not have access to Hyperloop.
Once I can successfully build the wrapped module, I would call an initialization function which triggers a native bluetooth hardware search. Once connected, there are functions within the module to send commands to the hardware and receive data back. This is the official documentation I've followed so far:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Quick_Start
That helped me build the blank module, include it in the app, and ensure that it worked by calling the built in test property. From there it stops short of actually telling me what I need to know. These are the closest things I've found so far, while still not being what I need:
http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-AddaThird-PartyFramework
appcelerator module for existing ios project sdk
Heck, I still don't even know if I can do this within studio or if I have to edit the generic module in Xcode. Help! :) Many thanks in advance.
so first of all, this is not best practice and will cause possible problems in the future when the SDK changes and your module still relies on outdated core API's.
Regarding your question, you could either create a new component that subclasses the existing class, e.g.
class TiMyModuleListViewProxy : TiUiListViewProxy {
}
and call it with
var myList = MyModule.createListView();
or you write a category to extend the existing API with your own logic, e.g.
#interface TiUIListViewProxy (MyListView)
- (void)setSomethingElse:(id)value;
#end
#implementation TiUIListViewProxy (MyListView)
- (void)setSomethingElse:(id)value
{
// Set the value of "somethingElse" now
}
#end
I would prefer the second option since it matches a better Objective-C code-style, but please still be aware of the possible core-changes that might effect your implementation in the feature. Thanks!

Generic implementation of 3rd party Libraries and Frameworks in Swift

I see there’s many libraries, open source, like Cocos2d, ShareKit, FormatterKit, etc. that seems up to date. (Check GitHub).
But still, implementation, snippets, samples and manual are intended to be written in Objective-C.
But, a method is a method… I think… If I get an instance of any framework/library of these and I call the method in a full Swift enviroment, would I be affected behind the scenes?
After June WWDC Swift gonna get serious, Apple is pushing hard, I’m just getting ready for the move and I don’t want my Apps to implement a soon-to-be deprecated library implementation in Objective-C.
I do not understand your question so much that I will regard your question as "Is it possible to use the Objective-C&Swiftin the same project?"
Yes, Apple claimed that developers can use Bridging-Header to implement double languages development, whatever your main developing language is ObjC or Swift. The specific details and theories about it you shall check from there.
Next I want to tell you some errors occurred in my project when I used Bridging-Header.
I always meet this kind of problem like import 'file not found'. I think you can try to check your file&folder hierarchy. Such as you have a root folder named Project, as is often the case, there is another Project in your previous Project, the root folder.
And Checking the Objective-C Bridging Header in the Build Setting. Sometime error can occurred for Project/Project/Bridging-Header.h. And the error can be corrected by changing the definition as Project/Bridging-Header.h.
If the location of Bridging-Header.h is not matching with the definition in the Build Setting, the error like import file not found will occur.
I just tell your my solution for Bridging issue I already met, I hope it can help you.

Resources