Swift Extension Issues - ios

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?

Related

Data Serialisation in Objective-C (Avro alternative)

I've been the last week trying to serialise all of the classes of one iOS project (Objective-C).
Due to I use to do it in Android projects with Avro (Apache) library, I've been trying to do the same in the iOS project, however, the first thing that I noticed is that there is not too much information about Avro in iOS.
First thing I tried:
Implement the library ObjectiveAvro using CocoaPods but some classes in the library Avro C were not found when imported.
Second thing I tried:
Remove and do again the previous process but this time only with the Avro C library but the same error appeared.
Third thing I tried:
Implement BlueSteel framework using Carthage. This is a swift library but I wanted to try if I could use it somehow in an Objective-C project. I couldn't.
I just need to serialise and deserialise data providing a schema as you can do with Avro (Android) in an Objective-C project and the last thing that I want to do is convert the whole project to Swift.
So do you know what's the current way to do that in Objective-C?
I could figure it out how to do the Third thing I tried:
Basically, it's necessary to import the library through Carthage, then create a new Swift class which is the one that is going to "talk" with the Swift library, due to we are in an Objective-C project. XCode will ask you to add a "header-class" and press "yes".
Then it's as simple as using the Swift to call the library methods and call the Swift class from the current classes. Swift class in Objective-C project
Finally just to inform that the BlueSteel framework is a nightmare due to is really limited and really poor documented therefore I still don't know a real alternative.
However, if you're going to use it, have in mind that the classes are not autogenerated so you need to do manually the conversion to Avro and sign results.

Importing CocoaPod into Swift Playground Produces Expression Failed to Parse Error

I have several private pods that I'm already using successfully in my project. I added a Swift playground to the workspace (not to the project), and I've added an import Foo statement to the top of the playground.
Autocomplete is working for my pod modules, so things seem to be set up correctly. However, I'm getting this very obscure error:
expression failed to parse, fixed expression suggested:
#sourceLocation(file: "Foo.playground", line: 1)
It doesn't matter which line I put my import statement on; it always refers to line 1.
There is notably some Obj-C code in the framework that’s being imported. I’m not sure if that matters or not since it’s callable from the Swift in my app.
Any help would be appreciated!
Update (7/21/19): Still haven't been able to resolve this, but I was able to confirm that a much simpler Obj-C library is callable from a playground. So, it's just the complex one I was trying to call initially. Since this is proprietary, there's not a lot of info I can share, but if anyone has suggestions on what to try (or what I can genericize, extract, and share here), I'm happy to take a stab at it and update you. Thanks!

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

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.

Realm in today extension

I installed Realm manually, and it is working on my main app. But on the today extension, i can't even import RealmSwift. I apologise if this question is a newbie question, but I've been searching the web and I can't find a proper updated version. I have read https://realm.io/news/tutorial-sharing-data-between-watchkit-and-your-app/ but it's written a year ago and it does not work anymore.
So how do I go about using realm to share data between the main app and the extension?
Thanks for the help!
Even though that article is quite old (It's not even using Realm Swift! It's using the Objective-C version bridged to Swift!), the principles of using Realm with iOS 8 extensions haven't changed to the point where the information in there has become outdated.
The main points to consider:
For all intents and purposes, a Today Extension is a wholly separate app from your main app. It needs to be able to be fully self-contained in its operation.
As long as you're using the dynamic framework version, you can link one copy of RealmSwift.framework to both your main app, and the extension.
You need to make sure you've set your Realm file to be saved in the containerURLForSecurityApplicationGroupIdentifier URL. This is the only place where your main app and the extension can share files.
Because the Today extension is technically a separate app, make sure any Object subclasses you've made are included in both your main app, and your extension's 'Compile Sources' build phases.
Please let me know if you need any more clarification. :)

Whirlyglobe private API complain during app submission

I have a simple app which uses whirlyglobe framework (2.2). Otherwise, it is pretty basic program with Apple frameworks.
When I tried to validate the app (and during the distribution, Xcode complains that my app is using private API; specifically it calls "rootElement", and "attributeForFont:". I suspect these functions are part of WhilyGlobe component distribution.
What is the easiest way to remove those files from the framework? Do I need to have the source and compile the framework myself? Or is there a simpler way?
Solved. Here is what I did:
1) Searched in github repository of WhirlyGlobe and found the file that uses the functions which caused issue.
2) I did not need the functionality provided by the file that had the functions.
3) Removed the references (class instantiation) to the file from my project.
That's actually part of the KissXML framework and the implementation is in there. I suspect Apple's test is in error.
In any case, if you're not using the WMS functionality, you can probably drop it out just fine.

Resources