Swift - Execute SSH Command in iOS - ios

I want to execute a Shell Command in my Swift Application.
I read that i can't use NSTask, because there is no built in SSH in the iPhone. Now my question is how i can implement this without NSTask.

Instead of creating your own app you may want to look into an iOS app called 'Workflow'. It includes a module called 'Run Script Over SSH' which does exactly what the title states.

Any use of API that forks and spawns a new process is disallowed by the App Store rules, so if you want to do this for an app you plan to submit, the short answer is that you can't.
NSTask and the exec*(3) family of C library functions certainly exist on iOS, but they aren't public API.
If you need SSH functionality, you need to find a library that provides that functionality to pass App Store review.

Related

Can I start using Flutter even though my app is already on Playstore?

I already uploaded my android app (written in Java) on Playstore, and now I want to upload it on Appstore as well. In order to save time, I decided to use a cross-platform, but I realized that I should have began to develop with Flutter since the beginning.
Is possible to start developing my app on Flutter even though it is already on Playstore? Or do I have to use another cross-platform like Kotlin multiplatform?
yeah sure you can start with flutter, you need to clarify these things :
package name should be the same as on Play Store.
you have to choose your old key alias and passwords.
For cross-platform you have to build a new app for the app store
You have java code that does not directly compile in flutter but you can use your logic and architecture which you build earlier you have to build new app for app store
But make sure you have to use your older package name and key store so you can override your java app(Live on play store) into a flutter app.
You can rewrite your app in Flutter and upload it to the Play Store to replace the current one. It’s just a matter of making sure to sign the built applications with the same key as it proves to Play Store that you are in control of both, and you’re making the switch willingly. Also, your new app will have to have a version greater than the one already available in the Play Store, as downgrades are not allowed.

How updating dynamic framework will affect App Store build

I have an app on the App Store and I have to create another app. This other app has some of the same functionalities as the first app. So I wanted to create a framework to put the common code in and use it inside the apps. Unfortunately, this framework has to change to add more features and improvements.
I saw that dynamic libraries can update the library code without any change to an app already pushed to the App Store. But this is reserved for Apple. Also, since iOS 8, we can create a dynamic framework which includes dynamic libraries. So is it possible to have the same, meaning if I update my dynamic framework, it also updates the app without having to push to the App Store again and face app review process?
If not, do you have some clues/recommendation to achieve that?
Dynamic Framework is a bit different from the understanding you have. Please read apple documents in more detail for that.
Currently only way to achieve what you expect is to push code on App Store as hidden, and based on some server API configuration update your content accordingly (Firebase Remote Config is one such good example if security is not that big a concern)

Add Fabric app (Twitter) without Xcode

I have this situation: I need to build my app on the command line, but I need to make changes too. (The tool I would be using is Fastlane).
I could enter the api keys externally, but the question is: How do I create a Fabric app without opening Xcode?
Thanks!
If you already have a Fabric account, all you need is the organisation API key. On the first launch of a new app, the app will automatically be created on Fabric.

How to programatically determine whether iOS app is from app store or has been copied to device during development?

I have some debugging code that I want to run when my app is either running in the simulator, or running on a development device (with or without debugger attached). I don't want this debugging code to run when the app is running on a device after being downloaded from the app store.
Is there any easy way to achieve this?
Note: The above-mentioned code will be in a library that will be used by other developers, so I would prefer to use some code that I can embed in this library, without requiring any further action from the developers using the library.
Although my library is a C# library (Xamarin.iOS), any Objective-C, Swift, or Xamarin.iOS answers would all be useful.
When you're running it on the simulator or in Xcode, you can set the Scheme to debug and just put if-statments in. When it runs from the store it won't be in debug mode unless you've hard coded that somewhere.
To answer your question directly: No you're not able to detect the apps source (App Store Vs Xcode deployment) as far as I know.
You can use DEBUG macro, it's defined in Objective-C projects for debug builds. But better way is to use your own macro to enable additional logging. Add information about this macro to docs and developer will decide to enable logging or not by defining it in his project. Also how to set preprocessor macros I described in this answer.

Is NSPortMessage in the iOS API?

I am trying to write a demo according to Thread Programming Guide about run loops.
When I implement NSPortDelegate's - (void)handlePortMessage:(NSPortMessage *)portMessage; method it prompts an error:
Receiver type 'NSPortMessage' for instance message is a forward declaration
So I try to import by "Foundation/NSPortMessage.h", after which it says:
Foundation/NSPortMessage.h file not found.
So I wonder whether we can use NSPortMesssage in iOS?
NSPortMessage doesn't seem to be in the iOS documentation so is presumably a private API. Xcode does code completion of NSPortMessage for me when I try to use it, presumably because of the forward declaration. However, if I ask Xcode to show me the definition of NSPortMessage it says the symbol is not found which would confirm that it is a private API.
The class exists in the Objective-C Runtime on my iPhone 4s so it is on the device. However NSPortMessage allows inter-process communication which I assume would be against the iOS sandboxing security. Perhaps it will work for inter-thread communications though.
I certainly wouldn't try and use it in an app that is intended for the App Store.
Since the iOS version of distributed object programming guide and certain APIs are also deprecated, it seems that all stuff related to port-based input source are discouraged to be used for iOS development. But setting up a port-based channel to communicate between threads using Core Foundation function still be an available choice.

Resources