Cannot import tensorflow in Swift playground - swift

I am an iOS developer and trying to learn tensorflow
for my Xcode 11.2.1. I tried installing tensorflow using this link
I got the package in Xcode toolchain.
But after installation when I verified installation, it failed. Swift playground is giving error
No such module 'TensorFlow'
I created a new SwiftPlayground for macOS, still, no avail.
Later I again installed tensorflow through command-line from here and it too was successful.
This time I had created a normal swift file to verify installation, but this too failed.
There is an existing old question on same issue, but that has not been helpful to me. Can anyone help me knows solution to this?

Answers to your queries:
Swift Playgrounds are not yet supported (available in future) by S4TF toolchains.
You can only build app for macOS right now but support for other OSs will be available in future.
Before you run your Swift file via CMD you need to export PATH=/Library/Developer/Toolchains/{swift-toolchain}/usr/bin/"${PATH}" where you should replace {swift-toolchain} with your S4TF toolchain name (clicking tab will suggest you available toolchains on your system). Then running swift test.swift will be (hopefully) successful.
Note: S4TF is still in early stage of development & is ready for beginners and researchers to work with it. But I personally feel that if you're developing an app for iOS it's a little early. I hope Apple with announce this feature in WWDC either in 2020 or 2021.
I hope this was helpful!
-- Rahul Bhalley

Also, if you, as an iOS developer, want to deploy a model into an iOS app without "leaving Xcode (almost)", you may be able to replicate what this developer did here. The author of that PDF presented at a S4TF design meeting not long ago. You may have seen this in the Google Groups discussion.
A workaround for model saving for you could be: use Python interop > import Keras > ... > Save model as .h5. Then, perhaps, you could use Apple's Python-based coremltools for Keras to integrate the model—now in the .mlmodel format— into your iOS app. I haven't tested this yet.

Related

How do I run custom frameworks on swift playgrounds using macOS Mojave and Xcode 10

I'm developing a framework in swift targeting iOS devices. The usual pipeline include add a playground to the framework in order to test some functionalities. However, since the last update to macOS Mojave I always get messages like
No such module 'FrameWorkName'
I tried some solutions that I found on the internet, like create a workspace and add the framework and the playground, but even then it's not working. Keep in mind that the exactly same piece of code ran flawlessly on the previous OS.
How do I add custom frameworks to swift playgrounds in macOS Mojave with Xcode 10? Also, is there a better way to test custom frameworks? I understand that the swift playgrounds are trying to mimic the Jupiter-notebook style of coding, and that is awesome, but it stills need some improvement.
3rd party frameworks can’t simply be included in a playground
There is a way to solve it. It is well described in Paul Ardeleanu's post on Medium

'sharedApplication' is unavailable: not available on iOS (App Extension) for Segmentio/Analytics Pod

Running Xcode version 8.2.1, Swift 3, and Cocoapods version 1.1.1 and I can't for the life of me figure out how to resolve this issue. I need to use the analytics library but can't get past this error in the UIViewController+SEGScreen.m class:
Without forking, is there another solution here?
What exactly do you need to figure out? The API is not available when targeting iOS extensions. There is no solution but fixing the API. If this is an open source, the fix looks really simple (wrapping in a custom macro such #ifdef TARGET_EXTENSION). If not, time to use a properly written analytics framework, that takes into account all aspects of iOS development, not the most trivial ones only.

Firebase SDK (v2.5.0) in OSX framework

I'm trying to link to the Firebase SDK (v2.5.0) within my OS X framework, but it keeps telling me I am trying to link to a framework built for iOS.
It seems to state pretty clearly on the Firebase docs that the iOS framework can be used to build OS X clients as well, so does anyone know what I am doing wrong here?
ld: in /[...]/Firebase.framework/Firebase(Firebase.o), building for OSX, but linking in object file built for iOS, for architecture x86_64
As of 2.4.0 (changelog), Firebase no longer ships a single binary for iOS and OSX, but instead has multiple frameworks (Firebase.framework for iOS, FirebaseOSX.framework for OSX). Similarly, the iOS Cocoapod is named Firebase, while the OSX Cocoapod is named FirebaseOSX. This is due to several changes in our build process, such as adding bitcode support (which only makes sense on iOS).
We still build and release iOS and OSX through these channels, and continue to support OSX, though it's not heavily advertised (as you noticed). As mentioned, if you don't use Cocoapods, using https://cdn.firebase.com/ObjC/FirebasePlatform.framework-major.minor.patch.zip will get you the framework, then follow the Alternative Setup instructions for including it in your project.
You need to add some dependencies in your project's Build Phases:
libicucore.dylib
libc++.dylib
CFNetwork.framework
Security.framework
SystemConfiguration.framework
See the Apple docs on how to add these if you haven't done this before.
Ok, this is a bit weird.. But after digging around in the pod specs I noticed that the FirebaseOSX podspec links to a different url than the iOS pod (FirebaseOSX.framework and an older version).
So I decided to copy the framework url from the Firebase site, and change the name and try that, and it downloaded a OSX framework for me. This is really weird, because I can't for the life of me understand that I should do like that based on what I can read on the Firebase site, so I can't really consider this the official way as it doesn't really make any sense. But it seems to work for now..
So for v2.5.0 the url is:
https://cdn.firebase.com/ObjC/FirebaseOSX.framework-2.5.0.zip

Compile XCode Projects online

I'm using the mosync library for develop iPhone applications. It generates the Xcode project ,
now I need to compile it to make it run on a iphone. So for that I need a mac.
do anybody know somewhere online to find online compiler which do that with a web based interface?
--thanks in advance--
Its really a difficult ask, since apples terms of use on certificates stop people from doing this.
But I got a paid solution for the same problem you mentioned which provides Xcode on Macintosh with latest updates. It just cost about 10$-20$ per month. Initially, you will get the trial offer too. If you like it, then you can subscribe it.
But friends beware of those who provides hacintosh version.
You can refer to following link-
http://www.xcodeclub.com/
http://virtualmacosx.com/
If you want to compile C or C++ right on iPhone/iPad you can try CppCode ios app

Does Visual Studio 2010 support iPhone Development? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I develop for iPhone using a Windows development machine?
Does Visual Studio 2010 support iPhone Development?
I believe you can use Mono to develop for the iPhone. You can read more about this here www.mono-project.com/Mono:Iphone
This requires Static compilation, and I've heard the process is pretty difficult at this point. Here is an article that provides some details http://arstechnica.com/open-source/news/2009/01/open-source-mono-framework-brings-c-to-iphone-and-wii.ars
If you are beginning iPhone development similar to myself I'd suggest sticking with XCode and the Apple tools. Although they offer a different developer experience then we are used to from Microsoft tools, they seem to have a good helpful community around them.
Update: Mono Touch now allows you to do development using MonoDevelop and statically compile for the iPhone. Here is the link with more info http://monotouch.net/
Xcode must be used to develop for the iPhone. It is the only platform for which the iPhone SDK is available.
According to my knowlage, the iPhone SDK must be run on Mac OS system, so I dont think that
you will be able to develop using VS.
Okay, I know this post is old, but I feel as though I need to correct some things. First of all, it is entirely possible to develop for iPhone using Visual Studio 2010. The steps required to do so are long and complicated, but basically involve the following
(note: these are rough steps as I don't recall the exact commands I used to invoke these things, but I have managed to get a working ARM CortexA8 and A9 GCC compiler successfully running with the latest iOS Dev SDK on Win 7 x64 and using Visual Studio 2010)
Get Cygwin and make sure you grab the GCC compiler collection.
Get LLVM and the GCC front-end(not sure if Clang works as I haven't tried it)
Get ODCCTools.
Download the latest Xcode(from a torrent if you're on a PC). Note: Due to the fact that Xcode and the iOS SDK use various open source copyleft packages, Apple has to release the SDK to the general public for free. However, as of iOS 5, they've decided to make it so that only people using the App Store on a Mac can download it. I have attempted to contact Apple to see if they plan on releasing the various packages openly, but I haven't heard a response.
Compile LLVM
Compile ODCCTools. Note: ODCCTools requires some modifications in order for it to work with the latest LLVM GCC Front-end. I've contacted the current owner and he basically told me he is no longer supporting it.
Using the assembler and linker you just compiled from ODCCTools, recompile the GCC front-end.
At this point, you'll have a working compiler for the iOS platform using all the latest and greatest from the LLVM guys and the fixes and improvements that have been made to GCC(C++0x anyone?). Or, if you're really lazy and you don't want to go through all this hassle, you can use the compiler that is already generated from iphone-devtools. However, doing this will only give you a compiler that doesn't support the CortexA8 or A9 instruction set which means that your application will run a little slower, plus the are using an older version of GCC which means all the fixes and improvements that have been made in the last 4 years will be ignored.
All you need to do now is configure visual studio.
There are a few ways to configure visual studio to accept the new compiler you just made(or downloaded). I opted to use a python script which then generates makefiles and the various project/solution files, but you may want to choose something a little less heavyweight.
At this point, you should be able to compile for iphone, but in order to run on the iphone you need to jailbreak your phone. Jailbreaking is legal, but it does void your warranty. Once jailbroken, then you can use SSH to upload your executable to the phone and then you're done.
If you want to publish your app on the App Store, you'll still need to get a developer certificate and go through the publishing process outlined by Apple. At this point, you will need a Mac. If all you want to do is develop for the iPhone, then this will allow you to do so, but if you want to publish to the App Store, you will need a Mac.
The reason I went through the pain of doing all of this is because I have a very complicated setup for my continuous integration. I compile for 8 different target machines, 5 different configurations, and deploy and run massive amounts of unit tests. I didn't want to have to setup a different Mac box just to handle the iOS platform when I knew that I could just set it all up to run on one machine. Ultimately, trying to do iOS programming on a Win7 machine if iOS is your target platform is definitely not worth the hassle for ordinary developers.
Yes it is possible go to this link: http://www.pmbaty.com/iosbuildenv/
I don't think visual studio 2010 is supporting native iOS app development. But it is possible to write applications for ios using visual studio 2010.
As far as I am concerned, microsoft is trying to make it possible. According to my experiences of developing applications for iOS, I used mac air book, Xcode & iOS sdk for building iOS apps. The main language for building native iOS apps is objective c and the framework is cocoa touch. There is no support for these technolOgies in visual studio and .NET framework, although mono develop is trying a lot
iOS is the most advanced OS for mobile devices which is to us from Apple. According to their requirements for developing iOS apps you have to use:
Intel based mac OSX.
Ios sdk
Xcode or Dashcode.
All these are available on only apple mac. So no luck for .NET players. But you can pure c to develop ios apps on widows. Just google it.
I think it made you clear of the ios app developing processes, and it's requirement.
Thank you.
Due to the libraries used - I'm fairly sure you need to run this on a Mac OS System. You can do some basic gcc compiling using cygwin if you wanted to - but other than that I would think you'll need Mac OS
It's why most of us are stuck buying a Mac Mini - getting a putty knife and adding more RAM and then struggling to get our old LCD monitors to work
Apple supported development from within Visual Studio would be really great!
However, as far as i know Apple has absolutely no intention to release such a thing. Even the usage agreement that all iOS developers have to agree to disallows usage of the SDK on 'non-Apple branded computers'.
In my humble opinion, this is really a bad thing because it forces multi-platform applications to be developed on multiple operating systems.
Because of this, i have started implementing a Visual Studio 2010 package that allows for iOS development from within the IDE. To workaround the SDK agreement compilation is executed on a iOS powered device.
Development progress (including screenshots) can be folowed on:
http://www.petervrenken.nl/visual%20studio
Greetings,
Peter Vrenken
I think it's possible to identify a device/browser on the server side. Therefore, it should be possible to develop server-sided applications that behave like an iPhone app but run in the iPhone's Safari browser.
I could very well imagine that with VS2010 the device support is significant for the iPhone in the way that it comes with a special JavaScript Library that your Safari implicitly downloads the first time.
The Commerce Server appears to have a support like this already - good news for everybody who is not in love with Objective-C or maybe wants to minimize effort ind iPhone development
http://www.microsoft.com/downloads/details.aspx?FamilyID=2df25ab7-f38d-439e-9391-ef8f025e8064&displaylang=en