UIApplication.SharedApplication.TerminateWithSuccess is not there - iphone

Why isn't the TerminateWithSuccess method of the SharedApplication implemented in MonoTouch? How can I invoke it? or even better, how can I programmatically close the application?

terminateWithSuccess is private API, which is why MonoTouch does not surface it. You should still be able to call it by using a Selector.
Selector s = new Selector("terminateWithSuccess");
UIApplication.SharedApplication.PerformSelector(s, UIApplication.SharedApplication, 0)

FWIW- I received this last week- Looks like the time is UP for this method...
Thank you for submitting your update to xxxx to the App Store. During our review of your application we found it is using private APIs, which is in violation of the iPhone Developer Program License Agreement section 3.3.1; "3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs." While your application has not been rejected, it would be appropriate to resolve this issue in your next update.
The following non-public APIs are included in your application:
terminateWithSuccess
If you have defined methods in your source code with the same names as the above mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged with future submissions.
Please resolve this issue in your next update to xxx.

After posting the question i figured it out, but Matt beat me to it. Here's another way:
UIApplication.SharedApplication.PerformSelector(new Selector("terminateWithSuccess"), null, 0f);

Related

How to connect sensor devices to IOTF using API KEYS

I am doing an android application, I'd like to know how to connect sensor devices/applications to Bluemix IoTF using API keys, by saying that I just want to minimize the registration task from client side(sensor devices)as much as possible. I know how to register devices with deivce Id,token and authentication manually. but I just like to know that is there any other easy way around to do it. It would be great If I got some one shed light on this from scratch. Thanks in advance.
There is a rich set of REST based APIs available at:
https://docs.internetofthings.ibmcloud.com/devices/api.html
and fully documented here:
https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#/
One can use excellent REST based testing tools such as Postman for REST testing.
The reason I mention the REST APIs is that they provide a way for scripting or automating the registration of devices. There is an API called "Add device" that, when called, will register a new device instance of a specific device type against your IoT Foundation instance.
I could imagine a new device that knows it is not registered executing a self registration request to define itself as a new device type. What I would next suggest is that you read the links above and see if they make sense. If they answer your question fully, great. If not, simply post a new question that is specifically targeted at a specific areas and we'll be watching this set of tags and respond back as quickly as we can.

where to implement setUserIdentifier function from crashlytics in swift

I am new to swift.
I am now trying to implement crashlytics in to my app.
I have followed the tutorial to implement it for basic report but I want to implement userID so that I know who has problem using my app.
I have checked online and found setUserIdentifier function but I have no idea where to implement this function.
Do I need to call this function in every page or in app delegate.swift?
Please give me an example on how to implement this one function.
Thank you very much.
let phoneID = UIDevice.currentDevice().identifierForVendor.UUIDString
Fabric.with([Crashlytics()])
Crashlytics.sharedInstance().setUserIdentifier(phoneID)
I used this to solve the problem and get the phone id.
I would strongly discourage the #Jun-Luo 's approach of using UUUID.
Crashlytics.sharedInstance().setUserIdentifier("12345")
Crashlytics.sharedInstance().setUserEmail("mail#domain.com")
Crashlytics.sharedInstance().setUserName("AppUserName")
You can use any one of above to track the user. But its better to secure user privacy, hence all we need as a developer is a ID which we can easily tack back with our server side access.
Code Example
https://docs.fabric.io/apple/crashlytics/enhanced-reports.html

Identifying Private APIs in my application

I have read that one could use the class dump command line tool to identify private APIs in a project/application. I went through several tutorials but it was not useful to identify the private APIs i have used in my application.
So could someone please help me, by giving me step by step instructions as how to identify private APIs using class dump.
If there is any better, easier way of identifying private APIs, please share it with me.
The only way that you're going to have a private API in your own project is if you put it there yourself (or use some open source code that you didn't realize implemented private APIs). That said, people have ran into private-api related app approval issues even when not really using private apis.
One way to check your application for private API's is by using App Scanner.
http://www.chimpstudios.com/appscanner/
I haven't used it myself but I've had it recommended by colleagues.

Using BWToolkit Framework APIs

I received some helpful info from NSGod that informed me that using BWToolkit would possibly be rejected from Apple for using private APIs. The only object I used from BWToolkit was the BWSplitView (I needed the ability to toggleCollapse - like iTunes' Ping Sidebar - slides in and out). If anyone has any info on this possibly not working for the app store, or an alternative, it would be greatly appreciated!
You can find a fairly detailed discussion of this subject here: http://bwalkin.lighthouseapp.com/projects/36323-bwtoolkit/tickets/72
The gist is "It doesn't matter what you use in IB as long as you use the unchanged framework you will get rejected.", but removing the BWTokenField code from the framework is enough to get approval.
ByteProject has released a new version of the BWtoolkit without any private api.
They removed BWTokenField, which uses NSTokenAttachmentCell and this is private API3
more info here : http://byteproject.net/

Google Analytics Mobile (ipod/iphone) Custom Variables tracking

It's a bit of time I'm using analytics in my iPhone applications and I find it very useful...but apparently it seems to give me only the ability to track pageviews and events.
I just would like to know if there's a way to track even custom variables defined by me, as web analytics does.
I.e. I'm releasing the new version of my app and I would like to define a variable that reports me the version of the application (instead of defining a new action or pageview to track it).
the standard js api to handle that should be: _setCustomVar(index, name, value, opt_scope).
Is there a way to figure it out even on the mobile version of analytics?
A bit late, but yes : custom variables on iOS google analytics library is available since v1.1.
Notice that the setCustomVar() function should come before the trackPageview(). The information is only sent to Google Analytics during a pageview or an event, so keep that in mind when placing the code on your site.
Localytics provides exactly this functionality. For any event in your application, such as a button click or a level completion you may record the event as happening and associate with a Dictionary of keys and values which are reported back as event attributes. For an example and some more details, check out the blog post:
http://www.localytics.com/blog/post/new-feature-explored-event-attributes/