I have been trying to set up a program that sends a push notification for my app. First I used
this tutorial
http://mobiforge.com/developing/story/programming-apple-push-notification-services
From this I learned how to get my device’s token.
I tried following the rest of to tutorial, but got stuck near the end, which told me to download a class named PushMeBaby, and change some lines of code and run it. However I can’t even compile this application. It gives me the error:
The run destination My Mac 64-bit is not valid for Running the scheme ‘PushMeBaby’.
after many hours of trying to figure this out, I decided to switch to a new tutorial, because i couldn’t find a way to fix this one.
This lead me to java and a certain java class named JavaApns
http://code.google.com/p/javapns/
Inorder to install this library and to get it to work, you need to meet a few requirements
Here is where I think the problem arises. The 3rd requirement tells me to also download and install two other libraries :
bcprov-jdk15-146.jar
log4j-1.2.15.jar
The first library works fine, since there is no errors. However log4 comes in a zipped file, and whenever I try to unzip it, it gives me the error “An unexpected error occurred (28)” So I just go into the zip file and only unzip the library instead of the whole file (no errors). Then I put both libraries+JavaAPNS into my project and run it with
[my code]
import javapns.Push;
import javapns.communication.exceptions.CommunicationException;
import javapns.communication.exceptions.KeystoreException;
public class test {
public static void main(String[] args) {
try {
Push.alert("Hello World!", "MyCertificate.p12", "MyPassword",false, "MyDevicetoken");
} catch (CommunicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KeystoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Finally the error that this gives me is:
/////////////////////////////////////////////////////////////////////////////////
log4j:WARN No appenders could be found for logger (javapns.notification.Payload).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
/////////////////////////////////////////////////////////////////////////////////
I went to the link logging.apache.org/log4j/1.2/faq.html#noconfig, however it doesn’t really explain how to solve the problem. So if you have any ideas or suggestions ( Or you want to suggest a better library/tutorial) I would greatly appreciate it!
From the same link you went to:
Also: