Is Objective-C necessary for iOS development? [duplicate] - ios

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What programming languages can one use to develop iPhone, iPod Touch and iPad (iOs) applications?
I have a load of fairly simple scientific programs that I converted from Basic to C. I would like to put them onto the Apple App Store, and was just wondering if it is necessary to convert them to Obj-C first, or will the C code be OK as a start?
They are simple 'get user input', 'do some logic checks', 'do the calcs', 'output result' type progs.
Thanks for any help.

Objective-C has a fully functioning C underneath, and you can write pure C code and have it working.
However, i doubt you would be able to release a command-line application to App Store. You would have to create a user interface in Xcode, and that would definitely introduce Objective-C to your program. With that said, as long as you connect your program variables (outlets) to controls on the UI, and link UI buttons back to the program's functions (actions/methods), the main processing body of your function could be a copy of your C code.

Related

Does Apple allow execution of Lua scripts inside an iOS game or app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 months ago.
Improve this question
I am planning on building a Lua scripting engine into my iOS game engine to allow AI designers to control the game's AI. The game engine is written in Swift and SpriteKit and targets iOS on iPhone and iPad.
I have been reading lots of conflicting information online about whether Apple allows the execution of Lua scripts inside an iOS app. Does anyone know whether Apple allows this, as of 2022? I have found some answers online, including on StackOverflow, but some sources claim Apple allows this capability, and some say Apple does not.
There seems to be some distinction between downloading and executing scripting code, vs just executing the scripting code. I am Ok with bundling the Lua scripts into the packaged iOS bundle. I'd like to be able to dynamically download the Lua scripts, but it is not a requirement.
Note that I am able to include a copy of the Lua code in my Xcode project, included a bridging header with some Objective-C wrapper files, and can successfully call and execute Lua functions from Swift code, and vice versa. So technically this technique is possible, my question concerns whether Apple allows this.
In addition, in searching for an answer to this question, it appears that very few iOS games support modding. I was only able to find 2 or 3 games in which players claimed it was possible to write a mod for the iOS version of the game, but for even those, it was a little unclear whether the games actually allowed the mod on the mobile version. Mindustry was the only game that I could find in which you could install a mod on iOS. It is unclear to me whether the lack of modding support on iOS was due to Apple not allowing iOS apps to execute scripting code, which would effectively eliminate most games' modding capability, or whether the lack of modding on iOS was just because it's mostly PC gamers who write mods for their games. Mobile gamers just don't get into modding. So if anyone knows of any iOS games that support modding, especially via Lua scripts, could you post the name of the game?

Will I be able to restart my iPhone app programatically to apply language changes in Swift [duplicate]

This question already has answers here:
Force iphone app to restart programmatically?
(7 answers)
Closed 8 years ago.
I am developing an iPhone app in swift and wanted localisation feature inside it.
When the user selects a language in the app, the UI components such as labels/buttons,etc.,. fails to change the language and takes more time in some cases also.
So i needed to manually restart my app when the users want to change the language.
Can anyone please suggest me how to do that.
Thanks in advance.
Swift is a language, not an API. You have the same functionality available to you in Swift as in Objective C, although the syntax and ease of use may differ between the languages.
The answer you linked to therefore already answers the question.
Also, as Hemang points out, don't do this.
It's symptomatic of bad design that you would need to restart the app to change the displayed language.
It would be much better to fix the underlying problem than to apply a hacky band-aid solution such as this.
DONT EVER DO THIS... else you'll surely reject by Apple, I don't know what problem you're facing after user change different language from your app, because I'd worked on this kind of app before (which supports multiple language and user may able to change it while current running of the app). I don't have idea with Swift but in ObjectiveC it works perfect.
From Documentation, https://developer.apple.com/library/ios/qa/qa1561/_index.html
Warning: Do not call the exit function. Applications calling exit will appear to the user to have crashed, rather than performing a graceful termination and animating back to the Home screen.
NOT RECOMMENDED but still, you can ask user to Restart their app whenever they changed the language with proper message like, " needs to restart to take effect of language change, [please save your any on going work] and close and again open the app to see the effect, thanks !"
Here, the words inside <...> should be your app name, and [...] need to show if you're making an app that needs to save user information before exit?.

which xcode template I should use to test objective c code

I started learning IOS development a month ago. Normally, I use a single View Application in order to develop my IOS application.
Now, I just need to test some features in objective c like polymorphism, encapsulation and inheritance. However, I don't know which xcode template I should use for that.
Could you help me please?
Sorry for this rookie question
Edit
In other words, I don't want to test those features on an IOS application. Instead, I need a template like the one you would recommend to a new c++ student.
Check below links. It will help to study all beginning level tutorials.
http://www.appcoda.com/ios-programming-course/
and for objective C testing. you can use commend Line tool.

New to developing iOS apps [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
As someone who has never developed an iOS app but hopes to soon and has never had a Mac (to date) the whole XCode and process for developing apps was a little lost on me.
To start: things like which languages are supported in development was one area I wasn't sure of:
I've seen C, C++ and Objective-C referenced as the languages used to write the apps. But I've also seen JavaScript` + HTML + CSS and .NET as options and a host of other compiled languages, with people arguing if you can or can't use them.
Another thing I wondered about was Xcode, does it support all the mentioned languages? Or is an IDE built for a specific language such as Cocoa ? If it is, then how would someone use JavaScript for example to write the app?
I'm sure this is a fairly simple answer to Apple users, but I had some struggle trying to relate from a non-Apple background.
Updated
Thanks for the great answers and insight, hopefully other this post will be helpful to others who don't have an Apple / iOS background
All three language alternatives that you mentioned are available to iOS application developers *.
Objective-C/C++ offers a way of making native apps for iOS, you produce machine code that runs on the devices. You use Xcode to develop in these languages.
You can build apps in JavaScript + HTML + CSS because iOS comes with a browser. Apple offers a mode that gives your apps a completely native look and feel, so they do look like first-class citizens.
You can build your apps in C# as well by using Mono Touch. This is different from .NET, although the language is the same, because your code is compiled into binary ahead of time. Although using Mono Touch eliminates the learning curve associated with the new language, you need to go through a fair bit of learning to adapt your knowledge of .NET to a different platform.
* Except Cocoa, which is not a language, but a collective name for Apple's frameworks for developing under OS X and iOS.
iOS' native language is Objective-C. While it's true you can use C++ to make apps (Cocos for example, is mostly written in C++) it isn't the 'native language'.
As for the other languages you mention, while it's possible to create apps using them they won't be 'native' normally relying upon another IDE/Library, phone gap or adobe air for example. Most of these also support cross platform development.
Where I work we also use HTML5 to create a 'faux native' interface/experience.
If you're new to iOS it's worth while checking out Apple documentation/sample code at:
https://developer.apple.com
There is a wealth of knowledge there that should set you on the right path. It ins't however, something I'd recommend if you don't have any experience with object orientated programming.
Coming from a C++ background myself, I didn't find it too difficult but have been working on iOS for about 3 years (on and off) and am only just starting to really become truly fluent in it's processes and conventions.
Hope this helps, let me know if you want to know anything specific.

Am i allowed to use c++ in code which i plan to submit to applestore? (iPhone Product) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I've heard that apple drops a lot of app submissions due to their stiff terms.
I dont want to get too far with my project because i know that it will be hard
to rewrite it later.
Now i began rewriting it to Objective-C (from c++) because i got somehow the
impression that apple takes only pure objective-c code. In some places on the
net, people offers solutions in c\c++ for problems which cannot be solved
with objective-c which makes me kinda think rewriting again.
In order to clear things out, can someone please give me a direction to where can
i find those iphone-code-terms of apple?
You can use C++ or Objective C++ in an iPhone app for the AppStore. There's no problem with that. Obviously you'll need some Objective C or Objective C++ in order to present a UI to the user, but everything else can be straight C++ if you're so inclined. Many applications (particularly game ports) take this approach, using C/C++ code developed on other platforms, and 'wrapping' it in an Objective C shell.
You can use any language you like, provided it is compiled code. Interpreters are banned, which means no Python or Ruby... but you can use Lua, lisp, C, C++, Obj-C, Java (using something like gcj, not a JVM), D, Haskell, or anything else that can compile to ARM code or a static LLVM backend.
At least the SpeakHere sample application makes extensive use of C++. If that has, chances are that many sample apps do (and hence that your app may use C++/Objective-C++).
Objective C is a super set of C++, so it should be no problem if you use C++. The full terms and condition are at http://developer.apple.com/iphone which is a must for any iPhone developer. The SDK is part of the 99US$ membership and includes tools you will need, such as the iPhone simulator and tools to allow you to test your app on your real iPhone. Additionally, you will need this membership to submit your app to the appstore.

Resources