I'm try to create the push notification on my app, and using this script paste on application didReceiceRemoteNotification function:
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
messageContent, #"alert",
#"Increment", #"badge",
nil];
PFPush *push = [[PFPush alloc] init];
[push setChannel:chatRoomName];
[push setData:data];
[push sendPushInBackground];
But, I just can show the push message, there are no badge number show on my app right corner.. what's causing the problem?
for setting badge number you need to refere below url. that will give your required ans.
change Badge and push notification in iPhone SDK
Related
i want to share app info on social network with all social networking application that are previously installed in device. i have one demo images just like this, if any idea please give me.
Thanks in advance
Using UIActivityViewController you can Share, apple doc
Example:
UIImage *anImage = [UIImage imageNamed:#"SampleImg.png"];
NSArray *Items = [NSArray arrayWithObjects:
#"your app info",
anImage, nil];
UIActivityViewController *ActivityView =
[[UIActivityViewController alloc]
initWithActivityItems:Items applicationActivities:nil];
[self presentViewController:ActivityView animated:YES completion:nil];
Here’s a UI control called REActivityViewController from Roman Efimov that looks like a UIActivity view, but allows for full color icons, total customization, and the control works with iOS 5.0. The control looks and works as expected on iPhone and iPad.
This is not simply a control that looks like UIActivityController, but also makes it much easier to create custom activities.
Here’s an example from the readme showing how easy it is to create a custom activity controller:
REActivity *customActivity = [[REActivity alloc] initWithTitle:#"Custom"
image:[UIImage
imageNamed:#"REActivityViewController.bundle/Icon_Custom"]
actionBlock:^(REActivity *activity, REActivityViewController *activityViewController){
{
[activityViewController dismissViewControllerAnimated:YES completion:^{NSLog(#"Hey, there!");}
];
}];
Try this.Happy coding.
I just noticed in iOS 6 that in your default Mail app, if you tap an itunes URL, an app store dialog box actually opens displaying the app's details.
There's no redirect to the app store! This box shows the screenshots, descriptions, etc. as if you were already in the app store.
I'm wondering if its possible to launch this box from inside my own app. I currently use itms-apps:// which naturally leaves my app, and goes to the app store.
If you are developing for iOS 6+ only, you can use SKStoreProductViewController.
Something like this:
SKStoreProductViewController *storeViewController =
[[SKStoreProductViewController alloc] init];
storeViewController.delegate = self;
NSDictionary *parameters =
#{SKStoreProductParameterITunesItemIdentifier:
[NSNumber numberWithInteger:333700869]}; //Identifier of the item you want to buy.
[storeViewController loadProductWithParameters:parameters
completionBlock:^(BOOL result, NSError *error) {
if (result)
[self presentViewController:storeViewController
animated:YES
completion:nil];
}];
(Code from this tutorial.)
Currently i am working in iPhone application, Using MFMessageComposeViewController to develop this application and its working fine.
But i want, message compose screen don't show on the screen, then the Message send programmatically ,
How to do this? it is possible? please help me
I tried this:
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
controller.body = #"Hi";
controller.recipients = [NSArray arrayWithObjects:#"12345678", #"87654321", nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
I've tried to do this once but but it wont be accepted by app store. Apple wont let you send message/email without user knowledge about it.
You can use a sms:[target phone number] URL to open the SMS application, but there are no indications on how to prefill a SMS body with text (see this post on Apple Developer Forums).
You can't use the Message Framework to send a message without the user knowing about it. One common solution is to send the message details to a web service running on your server and send the message from the server. As long as you're not trying to be sneaky, I don't think there's anything wrong with doing that.
As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter, but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem... The problem is that MPMusicPlayerController is used to play iPod Music only, and not locally stored files. Is there a way around this in iOS 5?
You can create your own NSDictionary and supply that to the MPNowPlayingInfoCenter.
NSArray *keys = [NSArray arrayWithObjects:MPMediaItemPropertyAlbumTitle, MPMediaItemPropertyArtist, ..., nil];
NSArray *values = [NSArray arrayWithObjects:#"Album", #"Artist", ..., nil];
NSDictionary *mediaInfo = [NSDictionary dictionaryWithObjects:values forKeys:keys];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mediaInfo];
I am implementing an iphone application (iOS 4.2) from where I would like to trigger the email client to send messages with attachments. I could effectively use uri schemes in combination with the class NSURL in order to trigger the email app but I was wondering whether it is possible to attach images. I have tried with mailto:whoever#wherever.org?subject=sthg&body=sthgelse&attachment=/path/to/file but the attachments are not included. I know iphone applications are sandboxed therefore it is possible that the email utility were not able to access the path to my image since it is located in my application bundle. On the other hand I was considering to administer my images with the photo manager. (1) Is there a way to include attachments in this way? (2) If so, is it possible to reference images either from my app or from the photo client? I could not find any attachments argument in the mailto RFC but maybe Apple has provided some way to achieve this.
Thanks in advance for your help,
Luis
MFMailComposeViewController will be able to do that, some example of usage belows:
remember to add MessageUI.framework
MFMailComposeViewController *email = [[MFMailComposeViewController alloc] init];
email.mailComposeDelegate = self;
[email setSubject:#"Whatever"];
// Set up recipients
NSArray recipients = [NSArray arrayWithObject:#"whoever#wherever.org"];
[email setToRecipients:recipients];
// Attach an image to the email
UIImage *attachment = ...;
NSData *data = UIImagePNGRepresentation(attachment);
[email addAttachmentData:myData mimeType:#"image/png" fileName:#"ok.png"];
// Fill out the email body text
NSString *emailBody = #"test mail";
[email setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[email release];
Instead of using the mailto: URL scheme, you should use the MFMailComposeViewController which allows you to add attachments. It also has the added benefit that using will not leave your app.
If one does not have account MFMailComposeViewController simply crashes.
Yes, you can call canSendMail first with the result NO(!), what next?
The answer is - use 'mailto:'. It'll popup dialog to create account.