I am testing applications on device, I used bundle identifier "mycompany.app" and after selecting proper code signing i am able to run the application on device(i.e my iPhone).
Now after successfully run this application I deleted that and used the same bundleId and provisioning to test other application which is of local notifications. so it start showing the badge number on the application Icon whenever the local notification generated.
Now again I deleted this application and try running my previous application with same bundle but it is showing the badge Number (ie 1) on application Icon even though I have not added any code for showing the badge Number to this application. How to remove these badge?
Hi please use following code in
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
function:-
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
Related
I have an app built that uses the UIDocumentBrowser. It was working fine until I tried to add an ImagePickerController to allow the app to use the camera and take photos. The Documents folder is now no where to be found on the "Files" app or in the app I am developing. I could find it in the Finder on the Mac I am using for developing the app.
I tried deleting the entire app and data and installing a cleaned build.
I have this sitting at the top of the app launch method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
_datapath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
if (![NSFileManager.defaultManager fileExistsAtPath:_datapath])
[NSFileManager.defaultManager createDirectoryAtPath:_datapath withIntermediateDirectories:YES attributes:nil error:nil];
When I run it in debug, it finds the already created documents folder so skips over the createDirectoryAtPath method.
Any ideas what's happening and/or how I can fix it?
Note: I never got to the point in the app where I could test the ImagePicker before this problem happened and removing the code I added didn't fix the problem.
Must have been cached information. Powered down the iPad and restarted fixed the problem.
I am trying to update my app with new "text reply" action added in iOS9.
I updated my code as per instruction in WWDC15 videos/documents and http://fancypixel.github.io/blog/2015/06/11/ios9-notifications-and-text-input/.
I am able to get reply button and text box in my notification on IOS9 beta 5. After typing the message the app delegate
(void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler{
i implemented also gets called. But "responseInfo" is coming null and i am unable to get the text.The "identifier" clearly shows "TEXT_ACTION". "category" in user info shows as 'reply'. The only piece missing is "responseInfo". Am i missing some more setting in order to receive the text i typed.
I had the exact same problem as you when I was on iOS 9.0, even though it had previously worked on iOS 9.0. I thought maybe updating to iOS 9.1 would fix it along with the update to XCode, but on the first push it the problem persisted. I kept continuing to send push notifications and reimplemented the delegate method with just a NSLog and it started working again. So I'm not really sure what fixed it.
Have you tried setting activationMode to background?
action.activationMode = .Background
action.activationMode.behavior = .TextInput
My didFinishLaunchingWithOptions method stores a filename from the UIApplicationLaunchOptionsURLKey and tries to open it.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
NSError* err;
if ([url checkResourcesIsReachableAndReturnError:&err])
{
...
}
}
For iOS 8 this code works fine. My application is launched because some other application selected "open in" to my application, but for iOS 9 this code doesn't work, and I get
err = NSCocoaErrorDomain : code 257 : "The file 'XXX' couldn't be
opened because you don't have permission to view it."
"The operation couldn't be completed. Operation not permitted"
Very important note: This only happens when my application was shut down while the user tried to open a file from another application. I see that the file that is being sent in UIApplicationLaunchOptionsURLKey is indeed located not in the same sandbox as my application is. If it was not shut down, just minimized, everything behaves well because the UIApplicationLaunchOptionsURLKey is in the same sandbox.
This was a problem in iOS 9 beta 3 that was resolved in beta 4.
didFinishLaunchingWithOptions method was triggered with a filepath in the UIApplicationLaunchOptionsURLKey that was in a different application's space, hence it was sandboxed and the iOS application could not access it.
Anyhow Apple now resolved this issue.
I am using PushSharp in my application for sending push notification. It's working fine for android.
For apple iOS - it's not working, we are using development certificate file with password.
Initially we have used wrong password then later we found that issue and fixed.
It's getting bellow error message
Channel Created for: PushSharp.Apple.ApplePushService Failure: PushSharp.Apple.ApplePushService -> Exception of type 'PushSharp.Apple.
NotificationFailureException' was thrown. -> {"aps":{"alert":"Hello World!","badge":7,"sound":"default"}}
Error status code:8
Error Description: Invalid token
App developed by one of our vendor and push notification we are doing from our side.
vendor sending push notification using some PHP code it's working.
To push notifications they were using PHP server with Laravel framework and library:https://github.com/davibennun/laravel-push-notification
I have installed that app on my iPhone's device and they send test push notification it's working fine.
But i was try to send using Pushsharp framework it's not working.
They saying development certificate file is correct it's working fine.
I have tried all possible option from my end but i am not getting any clue why its behaving odd with development certificate .p12. Please help me out to resolve this issue.
Code that we used for development:
var push = new PushBroker();
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "xxxxPass.p12"));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "xxxx12345")); //Extension method
push.QueueNotification(new AppleNotification()
.ForDeviceToken("a51b4e80d12df0946d10413991ce1f7ab57c05bab8a292fc703ded34ce77b91f")
.WithAlert("Hello World!")
.WithSound("default")
.WithBadge(7));
This issue has been because of invalid certificate file.
The following steps are done from my side in IOS app.
Created a new Xcode project Single View Application with Object-c Class.
Drog and Droped the WebView control and mapped to view controller.
In the “ViewController.h” file I have added below code.
#property (nonatomic, strong) IBOutlet UIView *site;
In the “AppDelegate.h” file I have added below code.
(void)viewDidLoad { [super viewDidLoad];
NSURL *url = [NSURL URLWithString:#”https://www.xxxxx.com”];
NSURLRequest *requestURL = [NSURLRequest requestWithURL:url];
[_site loadRequest:requestURL];
}
In the “AppDelegate.m” file I have added below code.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Register for Remote Notifications
if ([application respondsToSelector:#selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications
[application registerUserNotificationSettings:[UIUserNotificationSettings
settingsForTypes:(UIUserNotificationTypeSound |
UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
categories:nil]];
[application registerForRemoteNotifications];
}
else
{
// iOS < 8 Notifications
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
return YES;
}
In the xxxx Developer apple account – created a new App ID
Name:xxx
Bundle ID: com.xxxxdubai.xxxx
Push Notification Enabled for Development.
Created new Development SSL Certificate using following below steps.
Created certificate using CRS file Keychain Access ->Certificate Assitant -> Reqest a Certificate From a Certificate Authority… that’s generated CertificateSigningReq…Request file.
Uploaded CRS file under iOS Cerfiicate file and generated.
It’s automatically created under Certificates Development section
Name: com.xxxxdubai.xxxx
Type:APNs Development iOS
And then created Provisional Profiles for Development
Name: XXXX Development
Type: Ios Development
App ID: selected xxxx app id
Certificate: selected xxxx iOS development
Devices: selected my velus-iPhone device
Generated Provisioning Profiles successfully.
And then I did added Provisioning profile to Keychain access login and exported apns.dev.cert.p12 file with password.
In the Xcode APP project Build settings are changed to selected the Provisioning Profile (the one I did exported and registered)
Selected simulator as My your’s-iPhone device and Run the project it’s successfully installed and lunched the app on my mobile.
Automatically first time alert message shown from app for registering push notification with APNS server and the new device token received and logged to displayed in the debugging area.
Tested with PushShap framework with the new certificate apns.dev.cert.p12 and new device id push notification works successfully.
I'm viewing my top used version numbers in flurry for my app. It appears flurry is using the build number field (bundle version) in my plist to report what version a particular app is. Is this true? If so, can I have use a different field in my plist? (i.e Bundle Version string short) How? I frequently change the build number and I want to see something like 1.0.1 (a version) instead of 28 (a build number) in flurry.
I got bit by this too, it seems bizarre to me they would use the build number by default. I added an auto-incrementing build number script and by the time I next checked Flurry, it showed about 100 different "versions", each just a new build. Ugh, what a mess.
The good news is the Flurry API provides a way to explicitly set the reported app version at runtime. I have a #define in my prefix file that links to the "short version string", which in Apple's system is basically your user-facing app version (e.g. "1.0.2"), and is probably the one you want to be tracked in Flurry.
#define kAppVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleShortVersionString"]
Doing it this way means that you don't have to remember to set the version in more than one place. Set it in your target's "Identity" section or in the Info.plist file and you're done.
Then in my app delegate's application:didFinishLaunchingWithOptions: method, when I start up Flurry collections, I tell it to use that.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Flurry setCrashReportingEnabled:YES];
[Flurry setAppVersion:kAppVersion]; // <-- will now report your short version string
[Flurry startSession:kFlurryAPIKey];
// ...
}
Above method is deprecated instead user as below.
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
Flurry.startSession("xxxxxxxxxxxxxxxxxxx", with: FlurrySessionBuilder
.init()
.withCrashReporting(true)
.withLogLevel(FlurryLogLevelAll).withAppVersion(version))
}