MKMapView not Rendering in iOS 8 or later - ios8

I'm having an issue in MKMapView in iOS 8.x.x. Application works fine iOS 7.x.x but not in iOS 8.x.x. On device it shows only annotations but no map behind.
I tried to forcefully Reset my Device as well but no luck.
I added these 2 Values in info.plist as well as it was a requirement for iOS 8 and onwards
<key>NSLocationAlwaysUsageDescription</key>
<string>Location is required to find out where you are</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is required to find out where you are</string>
and added this lines of code in my Viewdidload.
// Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
if ([self.locationManager respondsToSelector:#selector(requestWhenInUseAuthorization)])
{
[self.locationManager requestWhenInUseAuthorization];
//[self.locationManager requestAlwaysAuthorization];
self.myMapView.showsUserLocation = YES;
}
By adding these 2 values in info.plist and the above lines of code, I'm able to get the User's Location and annotation in showing on map for user's location but Map is Blank.
Similar to this post:
MKMapView showing blank screen in iOS 8

Had the very same thing on IOS8.3 both sim and device.
Solved by running the system Maps App (it displayed empty grid as well) for a minute till it downloaded maps. After that my MKMapView started rendering as normal.

try add the delegate methods: - (void)mapViewWillStartLoadingMap:(MKMapView *)mapView;
- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView;
- (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error;
and check the solution for you error message.
also check this solution i don't got rid of the grind but at least i got rid of the didFail error.
but seems to be an issue of iOS8 because on iOS8.3 works fine the same code.

Related

XCODE iOS 8 iAD Load Error

I have a universal app that has been in use for several years with iAD Banner working. This was first implemented in iOS4, so it does not use ".canDisplayBanner" and does use the delegate. This has worked in all iOS versions.
With XCODE 6, it still works on simulator and device, iPhone and iPad, in development, when running on iOS7 target (aka, developer ad loads most of the time). If I run the same build on an iOS8 target, everything is the same, but ad Load ALWAYS gets error (3) ads not available, and NEVER become available.
As I understand it, iAd Banner should always return ads in development - regardless of iTunesConnect or provisioning. I have changed iOS Settings->Developer->(iAd Stuff), but no effect. Unfortunately, the Apple AdViewBanner and iAD docs appear to have only had formatting changes for iOS8, and are still essentially iOS6 docs. Searching the net, I can not find any one else with an iOS8 issue with iAd.
I can not determine is this is a coding issue/change for iOS8, or some type of Apple iAD service issue. Suggestions?

UIPickerView is not showing and CLLocationManager is not working in iOS 8

I want to my already build app work on iOS 8, so I install Xcode 6.0 and run my app into iOS 8 it is showing me few issues.
Picker view's values are not showing UIPickerView in iOS 8.
Location CLLocationManager is not working in iOS 8.
Kindly help me on these if some body faced these issues already. Looking for response.
Thanks.
In iOS 8 you need 2 parts to get permission for CLLocationManager.
Provide one of the following strings in the info.plist file
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
Call the appropriate permission method in code which matches the string above
requestAlwaysAuthorization
requestWhenInUseAuthorization

google map ios sdk: could not get current user location?

self.mapView.myLocationEnabled = true
println("ml")
println(mapView.myLocation)
I got nil for mapView.myLocation and I'm using an iPod for testing not an emulator.
The iPod's 'location services' is on.
I'm using xcode 6 beta 5 and targeting ios 8.
Enabling location services does not mean you get a location right away. It usually takes a little bit of time to get a location. You need to enable KVO observing on that property to be notified of changes.
The main reason is I need to declare NSLocationWhenInUseUsageDescription in info.plist for ios 8. Then everything else works!

White screen in Xcode 4.2 after conversion to Objective C ARC

I have combed through the entire internet looking for this answer , and have found nothing, so I have decided to post.
EQUIPMENT: Mac Mini (2011) , running OSXLion (10.7) , 8gb ram, 500gb hd
XCODE: version 4.2, running IPAD 4.3 and 5.0 simulators
I have developed an Ipad app using the program HYPE (html 5 designer/generator), this program was developed by an APPLE team. I then brought it into Xcode using the PhoneGap template. I had developed this app in a previous version of Xcode (4.0 using MAC osx snow leopard) and was able to transfer everything into Xcode 4.2 (including the phonegap template) successfully.
All was running fine. I launched my app in the app store successfully (Five Element Clinic Book HD - http://itunes.apple.com/us/app/five-element-clinic-book-hd/id495512918?alreadyRedirected=1&ign-mpt=uo%3D2&mt=8)
I noticed some issues I wanted to change (namely the external hosting was not working - my embeded youtube video (iframe) was not working, links to external websites not working and an iframe bringing in a counter script (javascript) also not showing - so I decided to take a look at everything to see if I adding more detailed URLs in the phonegap.plist external hosts area would work.
I didn't even get that far. When I opened Xcode again (after about 2 weeks, so there must have been some kind of API change) - I had a tone of errors that lead me to the information of needing to Convert my files over to Objective C ARC.
So I did this, with no errors or issues. Everything converted seamlessly. All files are showing converted to Objective C ARC.
I CLEANED then reBUILT - with absolutely no errors or warnings - and RAN my app in the IPAD simulator (4.3 and 5.0).
This is what happens. The simulator opens, my app launches, the start up screen shows, the app begins to load the rest of the app and just goes to a WHITE SCREEN. Forever. It goes no where else.
So I have quit the app, restarted the app, deleted the app, tried everything again. Same issue. If I quit the app it just goes to a black screen. I have also restarted Xcode and my computer, ran my disk warriors to fix file permissions, etc.
I still have my old project in my old laptop (Xcode 4.0, MAC OSx Snow Leopard). So I went back there to see if I could just work from the old environment. Nope. Same errors that require me to convert files to Objective C ARC. So I converted with zero issues and zero errors. Cleaned, Built - no errors) and ran the program in the simulators. None of them work, everything loads the start-up screen and goes to a white page.
Does ANYONE know what is going on?
And thank you.
Mine was not a white screen - but a black screen.
In applicationDidFinishLaunching I was using the result of
UIWindow* window = [[UIWindow alloc] initWithFrame:mainBounds];
as a local variable.
Converting to ARC released it.
Instead it needed to be assigned to a property of my app delegate:
#interface MyAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *mainWindow;
}

UIAlertView with text fields not moving up

I want to display a prompt to get a user's username and password.
I am doing this by displaying a UIAlertView and adding UITextFields as subviews to it.
Recently I moved my project over to XCode 4.2 and I updated all my project settings. My base SDK is set to iOS 5.0 and my deployment target is set to 4.0.
I then noticed that it was only being built for armv7 architectures and so I changed that to include armv6 as well since I would like to support the iPhone 3G as well.
After doing this I noticed that the UIAlertView wasn't moving up as before and now it was being covered by the keyboard when it was displayed. I read in the Apple documentation that you shouldn't subclass UIAlertViews (http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html) and so I changed the way I was doing things. This didn't solve the problem.
I have noticed that I can get it to work on my phone (an iPhone 4, so armv7 architecture) by setting the Build Setting - "Build active architecture only" to YES.
I suspect that the problem is something to do with trying to build for armv6 (and indeed removing this from the architectures I am trying to build for gives me alerts which move up correctly).
I suppose I should get to my question now... I'm struggling to understand why this is behaving the way it is. I read somewhere (can't find the link now) that you don't need to move the alert up manually when adding a text field to a UIAlertView in iOS 4 and above. Since I am building for at least iOS 4 shouldn't this work on both architectures?
Also, how can I get it to build for armv6 and still have alerts which move up correctly?
Edit: Maybe I was wrong but I have noticed that I have 2 instances of my phone which I can deploy the app to. Selecting the first one and building gives me an app where the UIAlertViews don't move up when they should, but selecting the second one makes it work properly. Would post a screenshot, but I'm a new user and so I don't have the permissions necessary yet...
Oki,
I've managed to come up with a solution which works and gets the UIAlertView to be in the correct position, but I'm still not entirely sure what the root cause of the problem is.
I solved it by responding to the UIAlertViewDelegate method willPresentAlertView: and doing the following
- (void) willPresentAlertView: (UIAlertView *) alertView {
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
if (keyWindow.center.y - alertView.center.y < 0.001f) {
CGPoint center = [alertView center];
center.y = center.y - 108.0f;
[alertView setCenter:center];
}
}
It checks whether the UIAlertView is in the center of the screen and moves it up if it is (i.e. if the OS hasn't already calculated the correct position of it). Note: You would need to add a check for which specific orientation the device is in and then adjust the amount the alert is moved up accordingly if you wanted this to work for both portrait and landscape orientations.

Resources