How to re-allow my app to use the current location - objective-c

I am using CLLocationManager to find the location.The first time that I run the app for mistake I didn't allow the app to use the current location.
So every time the delegate gets notified through the locationManager:didFailWithError selector.
I tried to make a clean build and to delete the project folder in derived data, but it still doesn't ask me to use the current location.
I would make possibile to re-select through that panel if I would use the location, how is that possibile?

You have to delete the application from the simulator or phone and then run another build onto the device.

I hope I understood you correctly, if I think that this is not a coding issue:
If you are on iOS6, you'll have to allow location services for the app at
Settings > Privacy > Location Services.
For more info, see Apple's documentation here: http://support.apple.com/kb/HT5467?viewlocale=en_US&locale=en_US

Related

Confused with IOS Deep linking

I'll just want to ask if someone here know the step by step process of creating a deep link for an IOS app? I've tried to read some articles but it did not give me absolute answers. Thank you :)
Deep linking is basically just setting up url to your app so that other apps can launch it with information. The can launch to certain parts of the app if you set it up so that your app reacts to certain urls. So there are a few things that you have to do. For this example I will use two apps. If you are trying to integrate with an existing app you just have to find out what their url schemes are. So for this example I will use 'Messages' as one app and 'Schedule' as another.
First: in the 'Messages' app we will need to setup the schemes our Schedule app to call.
So open up your first app we need to add schemes so other apps can open it. Go to your info.plist click the little + and type URL types hit the triangle to expand and hit the + type URL Schemes and within that one add an item and put your apps name in it. Also add URL identifier along with $(PRODUCT_BUNDLE_IDENTIFIER) as the value. `
Then we just have to add the apps that we can open so hit the top level + again and add LSApplicationQueriesSchemes This whitlists the apps so we can evaluate weather or not they are installed on the device.
Now we can jump over to the other app and create a way to call this. For this example lets make it happen when we press a button.
IBAction launchMessagesApp() {
let url = NSURL(string: "Messages://") where UIApplication.sharedApplication().canOpenURL(url) {
self.launchAppWithURL(url, name: "Messages")
}
The canOpenURL(url) checks to see if the application is on the device. If you wanted to you could launch the app store to your app if that retuned false. then launchAppWithURL actually launches it. That is the basic setup you may also want to have multiple things happen so you may have multiple url schemes that launch the same app but take it to different parts of the app. In the app delegate of the app in the function
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
print(url)
//Any customizations for the app here
}
You can do anything you can imagine.
Have you checked out Turnpike? It's an open source tool for enabling deep linking in iOS apps. http://urxtech.github.io/#GettingStarted
If you want to create a deeplink you might need to do some server code to detect the user device/browser and do some actions based on this.
I've created a tool that simplify this process, you can check it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.

How do I create an in-app settings view?

I want to create an in-app setting view like the following image:
What are these fields called? and what is the best way to create settings?
I found many tutorial but all of them are referring to creating the settings page in the phone settings, using the setting bundle and what I want is creating settings page in the app itself.
Both http://www.inappsettingskit.com and http://inscopeapps.com/#inappsettings both use the standard Settings.app bundle. So you have the ability to set defaults in your app AND in the standard Settings.app. They're simple enough to add your project and work pretty well.
If you only want the settings to be in the app, then your screen shot simply shows a standard UINavigationController with UITableViews. You can create something like this in the standard ways using Interface Builder or programatically, and then respond to any changed settings by saving NSUserDefaults objects/integers/booleans/URLs.
Whichever method you choose, add an observer for NSUserDefaultsDidChangeNotification in any views that need to respond instantly to the change (you can simply read the current value of the NSUserDefaults objects/integers/booleans/URLs in real time if you don't need something to respond instantly).
Try using In App Settings Kit.
Can be found here: http://www.inappsettingskit.com

How to add login Items by code to mountain lion osx

I want to add login items programmatically in Mountain Lion (10.8).
Until now I was able to add login items by editing this plist:
/Users/test/Library/Preferences/loginwindow.plist
and adding items (path,name,hide) to AutoLaunchedApplicationDictionary dictionary
in the OS doesn't work anymore. Items that are added to this dictionary are not launched on login. I see that the login items are saved in a file called: com.apple.loginitems.plist
but I don't understand how to add an item to this file. I tried to add the item to CustomListItems dictionary with parameters like name,path, hide but they were not launched on login.
Does anyone know how can I add from code login item?
I understand you want to start your program automatically when your user logs in.
In older versions of OS X, it was possible to add login items manually by editing loginwindow.plist. Apple deprecated this approach when they added LaunchAgent and LaunchDaemon functionality to the OS.
Since you are using Mountain Lion, the correct way to have a program launch is to create a launchagent for it. This is a .plist file that you can use to tell OS X to a) perform some action (e.g.: launch /some/program.app) when b) a specific event occurs (e.g.: logging in, logging out, etc)
You will find Apple's official document on creation of LaunchAgents over here.
This looks like a great tutorial on the modern way of doing things: The launch at login sandbox project
It starts with a paragraph buried in the App Sandbox design guide:
Creating a Login Item for Your App
To create a login item for your sandboxed app, use the SMLoginItemSetEnabled function (declared in ServiceManagement/SMLoginItem.h) as described in “Adding Login Items Using the Service Management Framework” in Daemons and Services Programming Guide.
(With App Sandbox, you cannot create a login item using functions in the LSSharedFileList.h header file. For example, you cannot use the function LSSharedFileListInsertItemURL. Nor can you manipulate the state of launch services, such as by using the function LSRegisterURL.)
And rolls from there...

NSUserNotification don't show application icon in notification [duplicate]

I'm using OSX's Notification Center APIs for the first time and can't seem to figure out how to make my app's icon to show up in the Notification badge.
The default "your app doesn't have an icon" icon keeps showing up:
Here's what I've done so far
I have created an icns file that includes 512, 256, 128, 32 & 16px versions
dragged the icon into the "App Icon" section of the target's summary
I made to sure to check the box to copy the icon into the project
the plist's "Icon file" section references the correct icon name (minus the .icns) part
Any ideas? The icon doesn't show up when I run the app thru Xcode or when I export an archive either.
I also have extracted the Sparrow.icns file from Sparrow.app and tried using that one instead of the one I made. That didn't work either.
I was able to fix this issue by incrementing the Build number in the General section for the build Target.
You can force the Notification Center to refresh all of the icons by deleting the Notification Center database file (~/Library/Application Support/NotificationCenter/SOME_UUID.db) and then killing the Notification Center process (e.g., from Activity Monitor).
Unfortunately this has the side effect of deleting your notification history, but this wasn't too much of an issue for me.
There's actually an ongoing debate on Apple's developer forums (link, link for people with access) about this. As far as I know, there's currently no real solution, but you can try the following:
Change your app's bundle ID and try it again. If you change it, clean your app, and change back, some people have reported success with seeing their icon show up.
Log in as another user. The caching Notification Center uses may be per-user, so you might be able to get the properly-iconned notifications as a different person.
The folder location has been moved for OSX 10.10+.
Following command takes to you to its new location:
$ cd `getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db
and then
$ open .
Easiest way that I managed to get the icon to show up is change the Bundle Identifier in your project. This works on OSX 10.10.5 and XCode 7.2
(Once notification center picks up the change, you can change it back to your original bundle identifier if you already have a provisioning profile associated with it)
I have solved the issue by archiving my app and adding a copy to my applications folder. When the app is in Application folder, the icon is always visible even you run the app from XCode...
I tried all of the above suggestions but the only thing that worked for me on 10.14 was to delete DerivedData:
rm -rf ~/Library/Developer/Xcode/DerivedData
If anyone still having this issue, and none of the methods above worked, here is how I solved it:
open Notifications from the System Preference (easiest is to open Alfred or spotlight and type Notifications)
find your application and remove it (press backspace/delete button)
NOTE: this may remove all notifications
I am using Xcode 11.5 and I had the same problem. In my case tough, it was sufficient to clean build output, close and reopen the project. Then do a fresh build and let it run again. The icon was there afterwards.
Side note: I've placed the app icon for every size in the assets.xcassets file, except 1024 x 1024 pixels. Don't know if this is relevant or not. Hope that helps.

CLLocationManager "turn on location services..." alertview customization ios

I know that I can't change the title or the buttons for this alertview, but i've seen numerous apps that changed the message of the alert view
Something like this
Also, I have the Bump API in my app so everytime the popup shows, it says "Bump uses your location to help determine whom you are bumping." and I don't want that displayed when they first use my app.
Does anybody know how I can change the message or change bump's message?
Thanks
To change the message of the alert, use the "purpose" property of CLLocationManager. Check the docs: http://developer.apple.com/library/IOs/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
I'm not sure how the Bump API works, but if you are just importing all the classes you need, you should be able to edit the location services message. Otherwise, one option would be to request location access before calling the Bump API's to get permission for your app. Once Bump checks, it will already have permission and skip presenting its own.