Appcelerator Titanium and Apple Pay - titanium

I am trying to use Apple Pay in a Titanium app. So far I've gotten it to work about a third of the time I run the app, the rest of the time the app crashes. My suspicion is that not adding the apple pay entitlement to the app is causing the crash (unfortunately there is no error message in the console when the app crashes).
Has anyone had any luck getting Apple Pay to work in a Titanium app?

Well, without advertising my Ti.ApplePay module, this might be the easiest way to adopt Apple Pay with Titanium. It supports all major Titanium versions and includes all native API's that are available. Give it a try or use a custom one :-)

I got it working. Here is a gist of the code in my module: https://gist.github.com/zach-babb-moovel/bd4172454cf54a178855e76ca5dd1f48. The key was wrapping the PKPaymentRequest and subsequent PKPaymentAuthorizationViewController parts in a dispatch_async call. You'll also have to make sure all your profiles are set up correctly and that you use a custom Entitlements.plist file for your Titanium project. Check out the Entitlements.plist here: https://github.com/hansemannn/applepaydemo/blob/master/Entitlements.plist for what it should look like.

Related

How to make my expo app appear in the share list of another app?

This question has been asked many times on stack overflow, but never for apps generated using the expo framework, which makes my app specific and incompatible with replies from other posts.
How can I make my expo app appear in the share list of another app? It seems the docs don't address this topic.
You can't.
At least not in the expo managed workflow at the time I'm writing this. If that's crucial for your app, you can eject, move to the bare workflow and give react-native-share-extension a shot.
PS: There's a feature request. I hope they'll implement it in the (near) future.

What is the best solution for Local Notifications in IOS for react native?

As the React Native website informs us PushNotificationsIOS is now deprecated. What is recommended is using https://github.com/react-native-community/react-native-push-notification-ios. However, this project does not seem to be maintained or commonly utilized. Frustratingly, it lacks Typescript support.
I am having problems using a Notification Content Extention for some nice custom iOS notifications. I suspect this has something to do with react-native-push-notification-ios's use of now deprecated UILocalNotification. Like many projects in the elephant graveyard that is the RN ecosystem, it seems painfully out of date. I'm reluctant to further troubleshoot my issues because it seems like a lonely, time consuming and potentially fruitless effort. Additionally, I'm trying to avoid writing a lot of native code.
Is there a solution I am missing here? Or am I asking for too much native support from React Native?
I always use firebase for my notifications. It works really well in my opinion. https://rnfirebase.io/docs/v5.x.x/notifications/introduction

Apple Watch on react-native

I want to get react-native working for the Apple Watch, but I'm not sure where to start
I started reading the code for the iOS implementation to figure out how they did it there.
My question is: are there any resources or guidelines for help to actually implement react-native (do they ever talk about this aspect of it) or do I need to just read through the code and figure it out on my own?
It would be nice if the react-native team made a document on how they got it up and running on iOS (or Android), though they may already have that out there which is what I'm looking for.
Thanks in advance for any advice and/or help
I was looking into this, too. I will share my findings.
According to this comment from the React Native team back in 2015, the team doesn't have resources to support it, yet.
Right now, we're focused on normal iOS and Android. We still a very small team and don't have the resources to target a different support right now. However, we open sourced React Native in the hope that we get help from the community to build those :)
Someone tried to build one with a lot of reverse engineering, but there are still unsolved issues causing crashes.

Titanium NSInvalidArgumentException

I'm trying to build a crossplatform (Android-ios) mobile application, using Titanium SDK. I didn't have a chance for a long time to build it for ios, I only used my Windows-android combination, to test it, and it works great on the Android system. But when i try to build it on the mac for the ios, i get this message, and the application shuts down in a second:
The application has crashed with an uncaught exception
'NSInvalidArgumentException'.
Since i can not provide any relevant code, because the exception doesn't show what's the problem with my javascript code, and I certainly didn't write any native, ios specific code, i have no idea, what to do.
From the few posts i have found here is what i have tried:
Restart Titanium Studio
Clean the project
Made sure to close any ResultSet, and DB objects when done with
them (as suggested here: topic)
Test the code on both 3.0.0 and 2.x.x versions
I'm looking forward to any advice, on how you solved this problem, if you had it!
Thanks in advance!
Update:
The problem was the following: I called hasOwnProperty on Titanium UI elements, and on the ios version these elements don't have this function (which is weird, since every javascript objects have it, if i'm not mistaken).
If you have similar problems, i recomend reading this article, besides mr.VVoos answer, it helps a lot in avoiding the problems i had!
I'm developing with Titanim and iOS & Android for a long time. Usually there are many differences between iOS and Android parts of the code.
In most cases this exceptions means that an operation is called that is not available for the called class. (In Java this would mean: Class.method() -> Class has no method called method()).
You can try to run the app in debug mode (on iOS Simulator). There is a big advantage debuggin iOS compared to Android. Usually the iOS simulator stops if there is an exception and it shows the JavaScript code that caused the exception. Unfortunately this doesn't work all the time and it only works on simulator.
If this does not provide any further information you can do the following:
- go to your app.js and set a breakpoint in one of the first lines.
- start app in debug mode.
- move on this breakpoint each time until your app crashes - maybe then you are able to detect the error or provide further information.
One last tip: Check your code if there are any platform-specific parts. (Like Android Intents and something that is not available on iOS).
I know that this can be very ugly but we had to solve many of these nasty issues while migrating from iOS to Android.

Objective-C playground?

Is there any sort of Mac app, Web app, or others like JSFiddle for Objective-C/Cocoa purposes?
It's not entirely the same, but look into F-Script: http://www.fscript.org/
It lets you rapid-prototype and experiment. You can also hook it into existing apps very easily. It has been invaluable for me for certain types of UI debugging.
I've also found CodeRunner to be quite handy for boilerplate app generation and one-click console running to try language snippets out. Available on the AppStore at a price.
I created playgrounds for Objective-C on top of code injection, so you can experiment with normal iOS simulator, it's open source on GitHub
Video showing them in action