Unwanted Communication Reporting extension can't send network request - ios

I am creating in the application support for the Unwanted Communication Reporting extension. All I found is this guide from Apple: https://developer.apple.com/documentation/sms_and_call_reporting/sms_and_call_spam_reporting and i follow it.
I've done:
Instantiates my ViewController from ILClassificationUIExtensionViewController.
Calls controller’s prepare(for:) method to customize UI.
Create button to notify the system when you have completed gathering information (setting setting isReadyForClassificationResponse property to true.)
Configure classificationResponse(for:) method after pressing Done button.
I want to send a response over the network so I add an associated domain to extension by following this instruction: https://developer.apple.com/documentation/xcode/supporting-associated-domain and advises from interenet. 
(Apple documentation supporting associated domain screenshots: https://i.stack.imgur.com/zxroa.png)
Create file apple-app-site-association, use classificationreport instead of webcredentials when specifying the domains.
{
 "applinks": {
  "apps": [],
  "details": [
   {
    "appID": “XXXX.com.project.UnwantedCommunicationExtension",
    "paths": ["*"]
   }
  ]
 },
 "classificationreport": {
   "apps": ["XXXX.com.project.UnwantedCommunicationExtension"]
  }
}
Add domain to the entitlement: https://i.stack.imgur.com/38qbn.png
Specify the network endpoint’s address using the ILClassificationExtensionNetworkReportDestination key in extension’s Info.plist file: https://i.stack.imgur.com/C6lbf.png
Create test server and sent the apple-app-site-association file to this server. 
Debugging and proxying my app, it doesn’t send any requests to the server. I can’t find any information about what request type should be sent, what data type will the server receive. Can anyone help to find information about it? Maybe advice what I did wrong, what settings should be on the server?

Related

iOS implementing NETunnelProviderProtocol with no remote server

I'm trying to implement a packet sniffer similar to Charles for iOS using iOS's NetworkExtension framework.
Objective
So, that's a big goal and I'm breaking it down into a tiny piece right now: I want to see the os_log from my NEPacketTunnelProvider (bottom box in diagram)
What I have done so far
I have created a NetworkExtension target on type PacketTunnel. This is the code snippet in the 3rd box in the diagram titled "NEPacketTunnelProvider".
I have included the "app groups", "personal VPN", and "Network extension" capabilities from within XCode.
Question
I am looking in the Console.app to see the output from os_log("STARTING TUNNEL!!!!"). When I load the configuration and make the call to startVPNTunnel(), why is my TunnelProvider code never called?
I have verified that startVPNTunnel() is being called by placing a breakpoint in my code.
There are a good number of reasons why your network extension process may not be starting:
I would put a breakpoint on the os_log("STARTING TUNNEL!!!!") and attach to your network extension process in Xcode via Debug -> Attach to Process by PID or Name... before you attempt to start the VPN
The network extension must extend the bundle id of the containing app. E.g. if the containing app is com.example.vpn then the network extension might be com.example.vpn.tunnel.
Ensure that your Network Extension Info.plist contains the NSExtension dictionary with NSExtensionPointIdentifier and NSExtensionPrincipalClass containing com.apple.networkextension.packet-tunnel and your NEPacketTunnelProvider class (e.g. $(PRODUCT_MODULE_NAME).PacketTunnelProvider) respectively.
Is the Packet Tunnel Provider Network Extension entitlement applied to both the containing application and the network extension?
If you are implementing a Packet Tunnel Provider, you do not want to enable the Personal VPN entitlement.
in startVPNTunnel func ,you should call setTunnelNetworkSettings,then the tunnel will started, after that ,you can read/write packet.
setTunnelNetworkSettings(nil) { error in
pendingStartCompletion(error)
}

Self-hosted Signal iOS is unable to connect to internet

same issue, other person: https://github.com/signalapp/Signal-iOS/issues/2282
We've checked out the Signal-iOS repository and we're trying to make it connect to another server. We're running an instance of the server at signal.appcraft.nl. We've modified the defines in SignalServiceKit/src/TSConstants.h to match our server and we've changed the domains in App Transport Security Settings in /Signal/Signal-Info.plist
We also cloned the Android app and that one we managed to got working just fine. The iOS app seems not to be able to connect to the internet at all without a clear error. The first HTTP call that is done is GET https://signal.appcraft.nl/v1/accounts/sms/code/<MYNUMBER>?client=ios. When we invoke that URL using curl, we get a response (and SMS) just fine. From the app, we receive a Signal was unable to connect to the internet. Please try from another WiFi network or use mobile data. error. We also changed NSAllowsArbitraryLoads to Yes.
We've added a breakpoint in /Signal-iOS/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m:292
# /Signal-iOS/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m:292
(lldb) expr error
(NSURLError *) $3 = 0x00000001c0244800 domain: #"NSURLErrorDomain" - code: 18446744073709550617
Please advise

Send Apple push notification from a Go appengine site

I'm trying to send an Apple push notification from a Go appengine site. I'm using the apns2 library as follows:
cert, err := certificate.FromPemFile(pemFile, "")
if err != nil {
log.Fatalf("cert error: %v", err)
}
client := apns2.NewClient(cert).Development()
n := &apns2.Notification{...}
if res, err := client.Push(n); err != nil { ... }
On a local development server, it works fine; but in production I'm seeing:
Post https://api.development.push.apple.com/3/device/995aa87050518ca346f7254f3484d7d5c731ee93c35e3c359db9ddf95d035003:
dial tcp: lookup api.development.push.apple.com on [::1]:53: dial udp [::1]:53: socket: operation not permitted
It looks like appengine expects you to use its own urlfetch library when sending outbound requests, so I tried setting the underlying HTTPClient to use that:
client.HTTPClient = urlfetch.Client(ctx)
However, the response from the Apple server is now
##?HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 504f5354202f332f6465766963652f393935616138373035
I believe the problem is that Apple push notifications require HTTP/2, but urlfetch only implements HTTP/1.1.
How do I solve this problem? Is there a way for an appengine app to send an HTTP/2 request?
This would require going through the App Engine Sockets API. The documentation states:
Libraries that can accept a net.Conn should work without modification.
You can get a net.Conn from the appengine/socket package and pass it to a lib that will accept one, but in the case of apns2 it doesn't allow you to do this. However another user has submitted a pull request to the apns2 project that adds a distinct GAEClient which can use App Engine sockets.
As of right now it looks like the commits still have not been pulled into the master branch, however you could still merge these updates manually into your own source tree as a workaround for now.
I dont know much about go appengine, but whatever it looks from the code, your client := apns2.NewClient(cert).Development() line seems to be defective, i think for production, you dont need development cert, you need to have distribution cert. So check that is there any option available for it. Also, is certificates from apple's dev site are generated by you or by go appengine. If you have manually created that, then you have to create 2 types of certificates, one for developement and one for distribution/production, and when app is running in production mode, you need to use that certificates.

How do I use Parse.com's push notification feature for a change in PFObjects?

Can I use Parse.com’s push notification feature to send an array of PFObjects to the user when either a new one is added, or an existing one is deleted?? If so, how should I go about it? I’m writing an app for iOS. Any help would be much appreciated.
Edit:
After doing a bit of searching, I see I have to use the cloud code aftersave() method, and then send a push notification through JavaScript.
If anyone could provide examples of how to go about it, that would be great. In the meantime I'm going through the docs. Thanks again all.
The Parse Documentation really contains everything you need to get started. Writing the code that sends the actual notification is only a small part of the whole process that is required to send push notifications. Here are the steps required:
Create an SSL Certificate: create the cert via Apple Developer Center then export it with Keychain Application
Create Provisioning Profile: also done via Apple Dev Center.
Configure Parse App: Change Parse settings, then upload the cert you created in step 1.
Configure App in Xcode: Change app to use provisioning profile you created in step 2.
Add Code to Prompt user for Notifications: write the code in your app that asks a user if they want to receive Push notifications, then store their device ID in Parse Installation class.
Send the Notification: as mentioned earlier this is the easiest step of all. It can be done via the Parse Dashboard (Click on Push notifications when looking at the Data Browser), via the Parse API or via Cloud-code. I did it via Cloud-Code and it looks like this:
// Find the Installation (i.e. iOS Device) that belongs to my user*
var query = new Parse.Query(Parse.Installation);
query.equalTo('user', user);
Parse.Push.send({
where: query, // Set our Installation query
data: {
alert: "This is the notification message",
badge: "Increment"
}
}).then( function(){
console.log("Push notification successfully sent!");
});
*I added a field in my installation class that captures a user. That way I know which device belongs to which user and can send targeted Push Notifications.
Prepare for Release: When you release your app, you will need to do some additional configuration to get everything ready to release.
Again, I recommend the Parse Docs. They are comprehensive and very helpful. Let me know if you have any additional questions. Hope this helps!
** BTW: If you don't have any experience with cloud-code, then you can complete steps 1-5, then manually send the notifications via the Parse Dashboard.

Nothing happening when sending push notification with raix:push

I am trying to do a push notification from the browser console using raix (version 2.6.1).
I have tried pushing using the php script from this tutorial and it works with the certificate and key I have, but when I tried it with raix, nothing happen on the phone. I tried doing:
Push.send({from: "pushfrom", title:"hello", text:"world", token:{apn: "my_ios_device_token"}});
This is my config.push.json
{
"apn": {
"passphrase": "xxxxxxx",
"key": "aps_key.pem",
"cert": "aps_cer.pem"
},
"badge": true,
"sound": true,
"alert": true,
"vibrate": true
}
I have insecure package, but still, I tried adding the Push.allow and it didn't help.
How do I know whether the notification is actually being pushed to APNS or nothing is happening at all?
I'll try giving as close to an answer as possible:
Try using the $ meteor shell server console to send messages, server doesn't require allow/deny rules for sending (it's a client-side security)
Behind the scenes theres actually two collections:
Push.notifications - containing the pending notifications to send (these are queued)
Push.appCollection - This one keeps and maintain the tokens (eg. removes tokens if revoked by gcm/apn services)
So you can use the meteor shell to check if the client app registres a push token - if it does then you should be ready to send a message to it eg. directly via the meteor shell.
If you don't get tokens from the client in the Push.appCollection - then you have a config or certificate issue - that's the hard part of push notifications.
If you get tokens into the Push.appCollection then it's prop. something with the server setup. This could be certificates, I've added a guide on the raix:push repo for testing server certs. Also think in ports, you need to have some ports open for your server to communicate with the gcm/apn service. Also think in firewalls etc. depending on your/client setup and security level on the wifi etc.
Please help out improving documentation on the project - I built the thing and take alot for granted, so there might be a missing clue etc. the documentation.
You can also use the query: {} instead of sending to one specific token (while testing)
Latest version is at 2.6.6,
Push notifications is besides scrolling the smallest hardest feature to work with.
Kind regards Morten

Resources