Undocumented method to find sim card availability in ios? - ios

I have found an undocumented method for detecting sim card availability in iphone. This method needs CoreTelephony.framework
NSString * CTSIMSupportGetSIMStatus();
int CTGetSignalStrength();
NSString *status = CTSIMSupportGetSIMStatus();
NSLog(#"Sim card status %#",status);
This method works well. can i use this method in my project? If i use this undocumented method, will apple reject my app? plz let me know... Thanks

You can not use undocumented method as Apple says that they can change the implementation for bug fixing or by updating the SDK cause App crash. They do not allow the use of Private API and trace at submission at store. Mostly private method can be found in debugging at Xcode and start with _Underscore so you can try alternative to achieving things if you do not want to get reject your application later at submission.

Related

Swift / iOS launch Apple Pay to a particular payment pass

Searching Apple Pay / Passkit / Wallet documentation, I've found very few code examples and pretty poor documentation. We're attempting to present a payment pass we've provisioned rather than just launch the wallet with openPaymentSetup().
According to PKPassLibrary docs, this can be achieved with PKPassLibrary.present(). We're invoking this function and it launches Apple Pay directly into the add a card wizard, which seems worse than the UX from openPaymentSetup().
The code we're using is:
let library: PKPassLibrary = PKPassLibrary()
let passes: [PKPass] = library.remotePaymentPasses()
if !passes.isEmpty, #available(iOS 10.0, *) {
library.present(passes[passes.count-1].paymentPass!)
} else {
library.openPaymentSetup()
}
We get the pass library and our passes, then conditionally attempt to present the last pass.
Does anyone know how to show a pass rather than launching a tutorial or add a card wizard?
You can still use presentPaymentPass api to present a PaymentPass. But your iOS version should be >=10.3.3 even if Apple Documentation says iOS version > 10.0. This is a wrong documentation from Apple.

Does Apple Allow to use JavaScript context in App Store?

I'm working on a project in which, I have UIWebView where I need to call some JavaScripts on a webpage in this UIWebView and that particular JavaScript will call my Objective-C native method.
To do that, I'm fetching context from UIWebView and setting my Objective-C object to the context and this object I'm fetching in JavaScriptand In JavaScript, object I'm calling a Objective-c with this function/method.
Here is the code I'm using to do above,
JSContext *context = nil;
context = [_webView valueForKeyPath:#"documentView.webView.mainFrame.javaScriptContext"];
// enable error logging
[context setExceptionHandler:^(JSContext *context, JSValue *value) {
NSLog(#"WEB JS: %#", value);
}];
context[#"MyObj"] = self;
So my simple question is, whether this way of doing this is ok, in terms of Apple Store. I mean, is there something that can cause my app to get rejected my Apple for App Store?
Thanks.
There is nothing currently in the App Store guidelines that would prohibit what you intend to do.
The ability to initiate functionality from a web server, even if it's via JavaScript in a web view, is common behavior.
Your app is run in a sandbox, so any security concerns are limited to your app. You're not adding code to your app, which is strictly prohibited. You're simply including functionality that may be called at a later time.
The short answer is that it depends on who reviews your app.
I have apps that do something very similar, and they were approved without issue. I have other apps rejected for doing the same thing because the JavaScript was considered "downloaded executable code".
To answer your specific question, I do not believe what you are doing in your Objective-C code will cause a problem with Apple's review, but depending on the source of the JavaScript, that may.
Bottom line is that Apple's review guidelines are still interpreted by humans at Apple, and that interpretation is not perfectly consistent.

How to get unique user ID for HockeyApp?

In the HockeyApp SDK v. 3.5, they have shifted to a new method of user identification. In previous versions of the SDK, there was a callback method - (NSString*)userNameForCrashManager:(BITCrashManager *)crashManager which would set a string which would identify all crash reports sent from the client.
However, in version 3.5 of the SDK, it seems that this is deprecated, and it is preferred that you simply call:
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation];
This sets a unique ID for the user. But how can I access this identifier? I want to attach it to support emails so that I can search for crash reports the user has submitted.
You can use the following delegate to set the userName:
- (NSString *)userNameForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager
This is documented in the header and help ofBITHockeyManagerDelegate and the replacement is also mentioned in the header and help of BITCrashManagerDelegate documentation.
BITAuthenticator is only used for beta distribution due to the fact that Apple removed the UDID calls from iOS 7. See the documentation and help. It is automatically disabled in App Store builds and without further setup creates anonymous IDs! Please read the mentioned documentation.
I think you are looking for publicInstallationIdentifier. That should return an NSString, unique for each user.
Look at this header file - BITAuthenticator.h .
Also, in the BITHockeyManager, there is a method called configureWithIdentifier: in which you can pass the identifier.

Deprecated methods in iOS

How can I check all the methods that were deprecated since iOS 4.3? Is there a website, that shows or filters all the methods that are deprecated in a give particular iOS?
The best place is to check in Apple Class Reference. Ex. for NSString.
This will be updated by them after every modification, and will be almost accurate and uptodate as compared to all other website, which in turn will get the information from here only.
if ([object respondsToSelector:#selector(methodName)])
{
// do something
}

Would apple allow this this non-public method?

I am using some non-public method to better control the slide effects of my application, for example:
[self dismissModalViewControllerWithTransition:2];
After trying to upload my App with the Application Loader I got the message that I can not use such non-public methods. I found in stackoverflow a nice workaround here: How does Apple know you are using private API?
So, I've adapted my code:
int tvalue = 2;
objc_msgSend(self, sel_getUid("dismissModalViewControllerWithTransition:"), tvalue);
After changing the code, the Application Loader did accept my binary. So here my question: can I get any problems when the App gets revised by apple?
Thanks in advance.
You cannot. Your app was not rejected because Apple could not track properly your code. Skip using non-public methods.

Resources