I'm using skmaps in a ios app, in this app i have to work offline with cities map and so i have to download the maps the user select. I have implemented the code in the example:
#import "MapJSONViewController.h"
#import "MapDownloadViewController.h"
The mapJsonViewController is initialized with this block of code:
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
NSArray *packages = [appDelegate.skMapsObject packagesForType:SKTPackageTypeContinent];
MapJSONViewController *mapXMLVC = [[MapJSONViewController alloc]initWithNibName:#"MapJSONViewController" bundle:nil withSKMapPackages:packages];
[self.navigationController pushViewController:mapXMLVC animated:YES];
With :
SKTPackageTypeContinent or SKTPackageTypeCity ecc...
I'm able to start the controller with the desired hierarchy level of elements but selecting the cities hierarchy i have found that many cities are missing... The documentation is a little bit poor about this detail but, how i can create a download for a city that isn't in that list? Maybe i can create a custom area to download setting some viewport coordinate (that's the best solution)?
Currently the only way of "adding" cities/regions to the list is to email the Scout/skobbler team directly and they will create the new map cuts for you (you cannot do it yourself via the SDK, programmatically).
Related
I'm having problems taking the first few steps with MapBox iOS SDK (1.4.1).
I've started with the suggested code over here: https://www.mapbox.com/mapbox-ios-sdk/examples/
- (void)viewDidLoad {
[super viewDidLoad];
self.mapBoxView.tileSource = [[RMMapboxSource alloc] initWithMapID:#"my_map_id" enablingDataOnMapView:_mapBoxView];
self.mapBoxView.userTrackingMode = RMUserTrackingModeNone;
CLLocationCoordinate2D centerLocation;
centerLocation.latitude = NRMapStartLatitude;
centerLocation.longitude = NRMapStartLongitude;
[self.mapBoxView setCenterCoordinate:centerLocation];
[self.mapBoxView setZoom:7 animated:YES];
}
No matter what I do the map starts at a location in Washington D.C. but I've set the center coordinate to be somewhere in Europe.
The same with the zoom. No matter what value I try it has no effect on the map.
There's something with the NSLog output that confuses me. At startup it says:
Using watermarked example map ID examples.map-z2effxa8. Please go to
https://mapbox.com and create your own map style.
I was assuming that this is something that I already did by registering for a free account there and starting with my first project.
Added the tilesource 'My First Map' to the container
Origin is calculated at: 120.786199, -85.000000 Map initialised. tileSource:RMMapboxSource:
Mapbox iOS Example, zooms 0-19, no interactivity, minZoom:2.000000, maxZoom:18.000000,
zoom:18.000000 at {-77.032458,38.913175}
Apparently the sample project in the iOS SDK is loaded and ignoring everything else I try to configure.
So, how do I configure the map so I can interact with the API. What am I missing?
Any kind of help is highly appreciated. Thank you!
OK, whoever is struggling with that. The trick is to set the zoom BEFORE you set the center coordinate..
..for whatever reason.
I have an app where I am trying to track screens with Google analytics.
I have set everything up in the delegate, and tried to automatically track three screens. Out of the three screens, only 1 of them is automatically tracking, the other two I had to track manually. I do not understand why this is the case, but I've tried looking for solutions and answers but none have come up.
The one class where the automatic screen tracking worked in in my SettingsViewController
in SettingsViewController.h I import "GAITrackedViewController.h"
and in SettingsViewController.m I do the following:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.screenName = #"Settings";//GOOGLE ANALYTICS WAS IN ViewWillDisappear
//rest of code
}
This works because in Google Analytics, I can see all the times that I've seen this view and I have all the tracking data necessary.
It gets annoying in my other two classes where I tried the EXACT SAME THING and did no get the same results.
In both my FriendView and HomeView I tried doing the automatic screen tracking, but that did not work in either view, so I tried implementing the manual screen tracking.
In both my HomeView and FriendView I do the following:
#import "GAI.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"
#import "GAITrackedViewController.h" //Import from when I tried automatic screen tracking
and then I do
-(void)viewDidAppear:(BOOL)animated{
//self.screenName = #"Friends";//GOOGLE ANALYTICS
[super viewWillAppear:animated];
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName
value:#"Friends"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
}
The manual tracking works better because I can see it under real time screen tracking. But for some reason I still cannot see FriendView or HomeView screen tracking under Behavior/ Screens in Google Analytics. The only data I have is from the SettingsView.
I would much rather use the automatic screen tracking because it is less code, but I have tried this solution and various others to try and get automatic screen tracking to work, and to be visible in Google analytics but it just does not.
To be clear, in both cases, the data does not show up in my screen tracking data. Only my settingsView data is visible and sending. The only difference is that when I do the manual screen tracking I can see the data come in real time, but it still does not show up in the general screen data view.
I am using v 3.0.7 in my app.
Thank you in advance for any solutions.
I also tried all different ways to track screen views in GA (manual vs auto, createAppView vs createScreenView, in viewDidAppear vs in viewWillAppear, etc) and for a long time I thought they weren't working. I also turned on verbose debug mode and everything seems correct (returning 200, screen name being logged as I expected). Later I realized that they were actually recorded, I was just looking at the wrong place in GA website.
They are not in Site Content/All Pages, and they are not in Behavior Flow, or Events/Pages. But if you select anything like an event, and select "Screen Name" as a primary or secondary dimension, then you can see all of them. Or you can create a customized report and directly display screen name.
I'm surprise that screen views are so hard to find in the GA web interface. I hope that Google can make a change to treat the screen views like web's pages, and be able to see a flow chart of the transitions.
EDIT:
Then I realized that it's because I'm posting all the data into a view that's configured for website, not for mobile app. (Initially we wanted to track app and web in the same view.) When I created a new GA view for mobile only, everything makes sense now.
Everything is perfectly fine only the section in which you are searching the screen is wrong. So go to > Reporting > Real Time > Screens to view you screen or else try to search SCREEN in the search box and that will give you various options then try them one by one to get the correct option.
To automatically measure views in your app, have your view controllers extend GAITrackedViewController. Set a property called screenName with the name of the screen that you want to appear in your reporting.
For example, suppose you have a “Home Screen” view that you want to measure with a view controller header that looks like this:
#interface HomeViewController : UIViewController
You would update this header to:
#import "GAITrackedViewController.h"
#interface HomeViewController : GAITrackedViewController
You must also provide the view name to be used in your Google Analytics reports. A good place to put this is the view controller's initializer method, if you have one, or the viewWillAppear: method:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.screenName = #"Home Screen";
}
For more information Please go through this link Google Analytics
the whole code is look like this
I am relatively new to iPhone development.
When I open Xcode, my object library palette contains an "Address Book People Picker View" and other objects that disappear when I select a .xib file. This seems to be consistent with the behavior mentioned here: XCode Developer API - Object Library - Objects Disappearing
The above answer suggests that the Xcode palette is initially populated with all iOS and Mac objects, but then amends the list appropriate to the target when the XIB file is selected. I thought that the AddressBook framework/objects were supported in iOS so if only iOS objects remain then why are the AddressBook objects disappearing?
Thanks in advance
I don't believe you can use the AddresBookUi framework objects in Interface Builder, but must instantiate them programmatically. Some of them used in specific ways to function correctly, for example ABUnknownPersonViewController must be embedded in a navigation controller.
Since many of these views cannot be used in a generic fashion they are not exposed in interface builder to prevent confusing users.
For example:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
I have tried to use MapView, but after finding out that I won't be able to add directions, I am switching to Apple Maps. At first I wanted to add a navigation bar so that I could go back to my app from Apple Maps, but I have been informed that that's not possible. So now, I want to know if I can change the page that opens when I click an annotation view disclosure button in Apple Maps, and possibly lead it back to my app that way by opening one of my local view controllers.
Apple is giving me a hard time with navigating these maps...
If it is possible, please give a code sample or something, or explain what else I can do to lead Apple Maps back to my app.
So far, I use this code to open Apple Maps:
- (IBAction)mapPressed1:(id)sender
{
CLLocationCoordinate2D miamizoo = CLLocationCoordinate2DMake(25.613336,-80.398437);
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:miamizoo addressDictionary:nil];
MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
item.name = #"Miami Zoo";
[item openInMapsWithLaunchOptions:nil];
}
Thanks; all help is appreciated.
my initial quess is that it will not be possible because apple maps is an independent app from the one you're writing.
Apple maps is a ready, closed up application without any modification possibilities, so you will not be able to change the behavior of the disclosure button / add a bar into apple maps.
Anyone, please prove me wrong, because I also was puzzled about the missing direction feature in the map API.You will either have to use overlays for directions in map API or you bite the bullet and buy a ready made direction api for maps.
The way I'm currently doing it is similar to yours. I start up apple maps with a direction request and change into it, no overlays.
I hope they will make up for that in ios7.
They do make up for it. Didnt have the chance to put my hands on the ios7 beta, but it will be there.
El
Update:
Thanks for all the tips, everyone. The tutorial mentions that a XIB file is provided (which I don't have) so I'm doing something wrong in how I'm creating the the project.
I am following Apple's Core Data Tutorial for iOS. This tutorial has not been updated for ARC—apparently for Xcode 4, since it asks to "create a new project using the Window-Based Application template in the iOS section."
Since that option doesn't exist under Xcode 4.4.1, I looked around Stack Overflow and read that I should create an empty application. As per the tutorial instructions, I created no Storyboard or NIB file.
Other than updating the code for ARC (using strong in place of retain and not implementing the provided dealloc method), I'm confident that the code in my project matches that of the tutorial up to the end of the chapter "The Table View Controller." At this point, the tutorial says I should be able to run the project and get a view.
Instead, I get a blank, black screen.
Maybe my problem is too vague to solve here, but should I perhaps be using a different project template? Which one?
I have only two classes: a RootViewController and an AppDelegate. AppDelegate imports RootViewController and contains a UIWindow property. Again, there is no Storyboard or NIB in the project.
I can provide any code too if there's someplace specific to look.
If you want to check if your setup is correct do the following:
add a background color to your window
self.window.backgroundColor = [UIColor whiteColor];
make sure you tell the window to display itself
[self.window makeKeyAndVisible];
make sure your view controller is the window's rootViewController
self.window.rootViewController = myViewControllerInstance;
Choose Single View Application, and uncheck 'Use storyboards" field. The rest should go the same.