Clustering with MapKit using Xcode 8+ and Swift 3+ - ios

I'm trying to use a third party solution for clustering annotations with MapKit.
I found this pod Cluster - https://github.com/efremidze/Cluster that seems to be for Swift 3.
Their example runs ok and I followed their guide for installations but I'm coming up with numerous errors.
Error ClusterManager has no member 'zoomLevel'
manager.zoomLevel = 17
Error Value of type Annotation has no member 'type'
annotation.type = .color(color, radius: 25)
Error Extra argument 'visibleMapRect' in call
manager.reload(mapView, visibleMapRect: mapView.visibleMapRect)

You have installed Cluster (1.0.5), that's why the error is shown. Please update your pod using pod update command or install Cluster 1.0.6

copy all files from "Sources" downloaded with demo, into your project

Related

MapBox Route Progress RouteStepProgress variables mostly return nil

I used to use the userDistanceToManeuverLocation variable from the RouteStepProgress Class but this seems to just return nil recently.
Just in case I was doing something wrong I tried following the MapBox iOS nav tutorial (https://docs.mapbox.com/help/tutorials/ios-navigation-sdk/) but this had the same result.
Going by the MapBox tutorial I would do the following to get the variable:
let navigationViewController = NavigationViewController(for: directionsRoute!)
let distance = navigationViewController.navigationService.routeProgress.currentLegProgress.currentStepProgress.userDistanceToManeuverLocation
I don't seem to see any error messages or other concerns. I would get this variable on every tick of the users location but now just returns nil. Thanks for any help
So after some testing I figured out the issue is to do with the newer versions of MapBox Navigation (SDK MapboxNavigation). Anything from version 0.29.0 onwards causes issues. For now I'm sticking with version 0.28.0 and will have to report this to MapBox
Edit:
It looks like the latest version (MapboxNavigation 0.38.0 at the time of writing this edit) appears to provide a solution. I now use distanceRemaining found in the RouteProgress class which does the same thing.

Upgrade to Swift 4. iOS Charts won't build

I'm using the Charts library from Github. The documentation indicates the Pod is updated to support XCode 9 and Swift 4 yet I'm getting errors.
I removed the pod by opening the podfile and removing that line. I then enter Pod Install into terminal, to remove it. I then reinstalled to make sure I have the most up to date branch.
The instruction is:
Add pod 'Charts' to your Podfile.
My error message is:
Cannot subsript a value of type [String: AnyObject] with an index of
type NSAttributedStringKey
The error occurs on the second and third line of this function:
var attrs = [String : AnyObject]()
attrs[NSFontAttributeName] = description.font
attrs[NSForegroundColorAttributeName] = description.textColor
ChartUtils.drawText(
context: context,
text: descriptionText,
point: position!,
align: description.textAlign,
attributes: attrs
)
I downloaded the new Swift 4 version and replaced the charts xcodeproj in my project, and it went like cream (Very smooth and easy) no 3.0.3 or pods (what are pods?)
The error in your question occurred when I upgraded to Swift 4 with the old Swift 3 charts source code. The error relates to type, and in my case mostly had a fix.
Excellent package well done Daniel

Use of undeclared type 'cocoapods library'

I made a pod Here and pushed cocoapods succesfully. When I try to test my library I added
pod 'TDTextSlider'
to my podfile of another test project.It is installed and imported without error but when I try to use the library with this code
let td : TDTextSlider = TDTextSlider(frame: UIScreen.main.bounds)
I got "Use of undeclared type TDTextSlider" error but when I copy the swift.class manually its working.What am i doing wrong?
Make sure the classes you are trying to access are public or Open.

Javascript / Native code out of sync (differing number of arguments) error

I have recently updated to ReactNativeControllers 2.03 from 1.24. I have also updated RN to 0.25. I am using a fork which only adds a Podspec file. After sorting out all the import changes in RN I am now stumped on this error:
(See also https://github.com/wix/react-native-controllers/issues/59)
RCCManager.setRootController was called with 3 arguments, but expects
2.
If you haven't changed this method yourself, this usually means that
your versions of the native code and JavaScript code are out of sync.
Updating both should make this error go away.
The code in question:
In RCCManagerModule.m:
setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps)
and in index.js:
ControllerRegistry: {
registerController: function (appKey, getControllerFunc) {
_controllerRegistry[appKey] = getControllerFunc();
},
setRootController: function (appKey, animationType = 'none', passProps = {}) {
var controller = _controllerRegistry[appKey];
if (controller === undefined) return;
var layout = controller.render();
_validateDrawerProps(layout);
RCCManager.setRootController(layout, animationType, passProps);
}
},
As is evident, both have 3 parameters.
I've killed and restarted the packager. I've cleaned the Xcode project including derived data, and deleted watchman cache with watchman watch-del-all. I've deleted my node_modules folder, done npm install and pod install.
I've rebuilt the Xcode project. Still no luck. I don't know how to debug this further.
EDIT: I also tried to clean the pod cache, updated to Cocoapods 1.01...
I have a feeling there may be a red herring here somewhere. For reference my full trace looks like this:
2016-06-10 14:15:18.179 [warn][tid:com.facebook.React.JavaScript] Warning: ReactNative.Component is deprecated. Use React.Component from the "react" package instead.
2016-06-10 14:15:18.239 JustTuner[7523:185768] Launching Couchbase Lite...
2016-06-10 14:15:19.048 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/
2016-06-10 14:15:19.050 JustTuner[7523:185768] Launching Couchbase Lite...
2016-06-10 14:15:19.058 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/
2016-06-10 14:15:19.538 [error][tid:main][RCTModuleMethod.m:456] RCCManager.setRootController was called with 3 arguments, but expects 2. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.
After spending many hours trying to work this out, I found that there was an out of date static library libReactNativeControllers.a in build/Products/Debug-iphonesimulator.
Deleting libReactNativeControllers.a and rebuilding the project solved the issue.
It seems that the Pod static libraries are now being saved in their respective folders e.g. build/Products/Debug-iphonesimulator/ReactNativeControllers/libReactNativeControllers.a
My guess is that the recent builds were saving the static lib in the subfolder, but the linker was picking up the out-of-date one. Anyone know why this might have changed recently?
Restarting metro with resetting cache worked for me:
react-native start --reset-cache
or
npm start -- --reset-cache
Try to Clean and Rebuild the solution in XCode if it happened in react-native iOS.

Firebase error with swift code

I have try everythng and I have imported pods to my project, done it several times in several new projects, but always get this error:
'Cannot call value of non-function type 'module'
Is it possible that my cocoa-pods are damaged somehow?
When I insert this code:
import Firebase
let BASE_URL = "my_project_url"
var FIREBASE_REF = FIRDatabase.database().reference()
I can see in Output/Debug window that I am connected with firebase, but when I start with code:
let BASE_URL = "my_project_url"
let FIREBASE_REF = Firebase(url: BASE_URL)
var CURRENT_USER: Firebase
{
let userID = NSUserDefaults.standardUserDefaults().valueForKey("uid") as! String
let currentUser = Firebase(url: "\(FIREBASE_REF)").childByAppendingPath("users").childByAppendingPath(userID)
return currentUser!
}
always get error. I have really try stuff from a lot tutorials, I tried a lot of things over past few days and nothing happened.
I have also look and read this topics, but did not help:
Cannot call value of non-function type 'module'
xcode error : Cannot call value of non-function type module Firebase
Unable to connect Firebase to my Xcode swift app?
I have open many new projects, done it import pod many times, I have import pod with insert in my pod file:
pod "Firebase"
and like this:
pod "Firebase"
pod "Firebase/Database"
also tried like this:
pod 'Firebase', '>= 2.5.1'
pod "Firebase/Database"
but always the same problem. Pods are inserted, I see Firebase folder and I know this is OK, so what could be wrong?
Like I said, I see that I am connected with Firebase in Debug window, as soon I start coding, error appears, and it is in every project like this, even when I try different approach and different code.
Any ideas?
You're either using the wrong version of Firebase, or following the wrong guide, depending on what you're trying to do.
Your pod config will install the latest version (3.2.1) while the code you've written is for 2.5.1 and before.

Resources