iOS Question Absolute beginner: where to start

udg

Expert
Licensed User
Longtime User
Hi all,

I've yet to install B4i but I'd like to read some simplified, good and updated directions on how to start the whole Apple-adventure (I'm absolutely not a fan of it but I'm requested to deliver iOS versions of my android apps).

As of today, I have got no iPhones or any other iOS mobile device, no Mac, no Apple account (I read in a few threads about iTunes, is it the same thing, a thing of the past or what?).

My first goal is to simply port and check an existing B4A app in the B4i IDE. It was as B4x-styled as possible so I'd like to load it in B4i, correct some points here and there, then (eventually) try a compilation toward the Hosting Builders just to know that everything is sorted out.
I found even a Bal2Bil converter so there's hope that I don't need to recreate every Designer file.

Second step will be to send the newly born iOS version to a beta tester. If I'm not wrong for this step I need to register as an Apple Developer, activate a new app in that panel, generate some certificates/provisioning files (specific to the app or just the couple developer/store?), go to TestFlight (a panel of the Apple Dev right?), and finally invite in the beta tester.

Third step is to understand how to distribute a finalized app. I know about a General Store and something called Business Account. The latter should be a reserved space (one for each customer) where to upload apps reserved to a specific customer. It probabily will have a mechanism to let the customer manage who can download the apps. It will ben nice to understand whether Apple will waste my time to check even for private, customer-specific apps or will let me publish in the Business Account area whatever I like.

Please be patient. I know nothing about Apple, but the old saying that one a day keeps the doctor away..eheh

TIA
 

tufanv

Expert
Licensed User
Longtime User
For the first step, you can use the hosted builder to compile your apps to a device but you need a device like iphone to work. ( you can also use the simulator with a local mac , but I don't think simulator will be enough while coding ). You can use the converter but you will need to fix some points as they won't be %100 same.

For the second step, you can simply add the tester's udid ( they can find their udid with udid.io or from itunes) to a provision file, and send them the IPA and they can test as they like. I don't bother with testflight or similar things.

I am not too much familiar with the accounts but as I heard, Apple is not allowing you to distrbute apps for different companies etc. For each company, they need to create their own account othwerise the apps you try to publish will not be accepted because of copyright etc even if you have the authorization because Apple needs to get $99 =)
 
Upvote 0

udg

Expert
Licensed User
Longtime User
For each company, they need to create their own account
Yes, as I understand it each of my customers needs to activate a Business Account where I will upload any custom-made apps.
This will be an alternative to put those same apps in the general market and asking the user to enter some "secret" code to properly run (or amy such a method to restrict the use to allowed audience). Considering my business model (only custom apps on request) I think the Business Account way will be the preferable one, but knowing how to publish to the general marketplace too won't hurt.

you can use the hosted builder to compile your apps to a device but you need a device like iphone to work
So it will be useless to install B4i as long as I don't buy an iOS device.
Even my plan to simply load the existing code and check for syntax and platform-related errors/warnings is out of reach unless I've an iOS device?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Yes, as I understand it each of my customers needs to activate a Business Account where I will upload any custom-made apps.
This will be an alternative to put those same apps in the general market and asking the user to enter some "secret" code to properly run (or amy such a method to restrict the use to allowed audience). Considering my business model (only custom apps on request) I think the Business Account way will be the preferable one, but knowing how to publish to the general marketplace too won't hurt.


So it will be useless to install B4i as long as I don't buy an iOS device.
Even my plan to simply load the existing code and check for syntax and platform-related errors/warnings is out of reach unless I've an iOS device?

You will need a device to test it somehow so you need an ios device or the simulator. But you can install the b4i, and correct the errors etc and if you have the hosted builder you can compile your app so you can fix those things without a device. When you see you are able to compile, it means that you have the basics fixed later you will need a device for more detailed testing.
 
  • Like
Reactions: udg
Upvote 0

udg

Expert
Licensed User
Longtime User
Ok, thank you.
Time for a coffee then it will be B4i-install time! :)
 
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
Ok, thank you.
Time for a coffee then it will be B4i-install time! :)

Good luck - iPhone is not so bad, once you get to know all their "Don't do that or I will slap you" antics.

Most of your points are correct you have mentioned in your earlier posts.

Something to look out for (due to the fact that these devices are expensive) is the 32 bit/64 bit issue when purchasing a device. The best one i have found so far is the iPhone 6S+ - neat phone with a fair sized screen and some decent speed to develop on.

If you want to skip TestFlight, thats OK now as they have a New Public Invite to Test System (But I would make friends with this - it's useful at times). It does however reside under TestFlight on your Apple account.

Pertaining to your customers - I think you and I follow the same Business Model, my advice is NOT to create their account immediately, but rather use your own with a note to the Apple Testers when you submit your app for BETA testing, that the Clients Account will be created and the app will be published there once approved by your Clients. Otherwise you spend precious development time on finding and submitting DUNS numbers, letters of permission to use Trademarks/Copyright and trying to convince your client that their credit card will not be used for fraud etc.

Bal2Bil works well, but has problems at times with very complex screens. The way I go about it is to open my Android designer (where I use a screen derivative and anchor points as close as possible to 640 x 360 - most common screen size in Android apparently) and then open the Designer on B4i and on the iPhone 6s+ the screen derivative to select is 414x736 and then build my screens on a one on one basis - take each item, place it on the Designer in B4i and then the sizes fit almost perfectly with minor adjustment (I mean copy co-ordinates etc from your Android side) - PLEASE TAKE NOTE here - to avoid a lot of frustration on your iPhone development is that the client can use 2 modes in their screen selection - Normal Mode and Zoomed Mode, for example, on an iPhone 6S+ - Normal will report 414x736 and Zoomed 375x667 - if you do not have anchors and "Font Size to Adjust" set then it looks like you are an amateur without experience to your client as everything falls off the edge of the screen.

BEWARE:
Public API's will be rejected outright and you will be threatened with a punch rather than a slap by Apple, so as far as possible, stick to the official libraries.

Most of your code is copy and paste and here and there you will find some incompatibilities (for eg. Message Box has an extra parameter) but they are quick and easy to fix.

Once your are ready for Beta Testing, you will see in B4i, there is a place under Tools-->Build Server-->Build Release App to follow. Once that is complete, then you use Tools-->Download Release - once that is complete to download an "Archive.zip", This then you Upload to your account by going to the same place (Tools-->Build Server) and Upload the Archive zip to your appropriate app and account.

One last thing to be aware of is the App icon - search here in the forum - there is a process and specific size that it must be and it must not contain any Alpha layers.

Other than that - enjoy it - it's not so bad !!
 
  • Like
Reactions: udg
Upvote 0

udg

Expert
Licensed User
Longtime User
Well, I tought I was starting it simple but even the most basic operation seems to need to be retooled..sigh!
I used to show a splash screen for 3 seconds, then, based on existence of a config file, switched to Login or FirstRegistration layouts.

General: where do b4A activity Globals go when in B4i? Should they be inserted in process_Globals and set as Private?

The following B4A code
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("lytMain2")
   'SPLASH
   tm.Initialize("splash",3000)
   ShowSplash
End Sub

Sub ShowSplash
   pnlBody.SetBackgroundImage(LoadBitmapResize(File.DirAssets, "splash1.png", pnlBody.width, pnlBody.height, True)).Gravity = Gravity.FILL
   tm.Enabled = True
End Sub

Sub splash_tick
   tm.Enabled = False
   If Not(Starter.UserData.IsInitialized) Then ShowFirstReg Else ShowLogin
End Sub

translates to ? It seems that B4i panels don't sport any background drawable so should I add an ImageView or a Canvas or other item to assign an image as the backgroud for a panel? I could transform the panel to a B4xView and use its SetBipmap. BTW, B4i panels seems to miss the Elevation attribute too

Tried (setting pnlBody to B4xView instead of Panel)
B4X:
pnlBody.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "splash1.png",pnlBody.Width, pnlBody.Height,True))

Another basic question: B4A activities translate to Pages in the Main code module or to additional code modules each with one or more pages?
Maybe what i can't understand at this time is the role of Pages (I mean multiple pages for a single Code module) if the app is not a Tab-styled one.

TIA
 
Last edited:
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
Right - let's give you a hand here.
General: where do b4A activity Globals go when in B4i? Should they be inserted in process_Globals and set as Private?
Correct.

You need this first as a minimum:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private scrMain As Page
    Private scrSplash As Page ' you can declare as many as you like - theoretically

       ' You can put here anything you like to declare and start what you want
End Sub

This part in B4a:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("lytMain2")
   'SPLASH
   tm.Initialize("splash",3000)
   ShowSplash
End Sub

Translates to this in B4i
B4X:
Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
 
    NavControl = Nav
    Nav.NavigationBarVisible = False
    scrMain.Initialize("scrMain")
'    scrMain.Title = "scrMain"
    scrMain.RootPanel.SetBorder(0, 0, 0)
    scrMain.RootPanel.Color = Colors.White
    NavControl.ShowPage(scrMain)

    scrSplash.Initialize("")
    scrSplash.RootPanel.LoadLayout("scrSplash")
    scrSplash.RootPanel.Color = Colors.White
    NavControl.ShowPage(scrSplash)

    pnlFade.SetAlphaAnimated(1500,1) ' I have a panel in scrSplash that fades in once scrSplash has loaded

   tm.Initialize("splash",3000)
   ShowSplash

End Sub

Once your timer fires, then use this to remove the page, keeping in mind that iOS stacks the pages like a deck of cards

B4X:
Sub splash_Tick
    TimeOut.Enabled = False
    Main.NavControl.RemoveCurrentPage2(True)

'  If Not(Starter.UserData.IsInitialized) Then ShowFirstReg Else ShowLogin - you don't have a starter here - so you'll have to modify this line
End Sub

Ok, Android use Activities - that we know - but iOS uses pages - so the question is now - how do you start a new page or code module ?
Firstly, add a new code module (as you would a new activity in Android)
then, use this code at the top of every code module

B4X:
'Code module

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Dim scrGetOTP As Page

End Sub

Public Sub Show
   
    Log("In Public Show modGetOTP") ' I use this to see if I have entered here
 
    scrGetOTP.Initialize("scrGetOTP")
    Log("Init 2 ? "&scrGetOTP.IsInitialized)
   
    If scrGetOTP.IsInitialized = False Then
        scrGetOTP.Initialize("scrGetOTP")
        scrGetOTP.RootPanel.LoadLayout("scrGetOTP")
    Else
        scrGetOTP.RootPanel.LoadLayout("scrGetOTP")
    End If

    Main.NavControl.ShowPage2(scrGetOTP,True)
    Main.NavControl.ToolBarVisible = False
   
End Sub

' Your other subs from here

And then, from any other page, how do you call this code module (actually as easy as falling of a bicycle)

B4X:
modGetOTP.Show ' Obviously, your code module was named as "modGetOTP"

Also Remember - NO MANIFEST FILE - all done with pLists and Entitlements, something like this:

B4X:
    #Entitlement: <key>aps-environment</key><string>production</string>
    #PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
    #PlistExtra: <key>NSExceptionDomains</key><dict>
    'list the excluded domains (example.com and b4x.com)
    #PlistExtra: <key>196.50.3.79</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>

Also remember, if you have screen size or font size problems, it's because this sub is missing

B4X:
Private Sub scrMain_Resize(Width As Int, Height As Int)

' Do what you need to here

End Sub

I trust I have not confused you too much. Enjoy your day !!
 
  • Like
Reactions: udg
Upvote 0

udg

Expert
Licensed User
Longtime User
Thank you very much.
Unfortunately there's a lot more work than I initially preventivated. Thanks to B4x it won't be as a full rewrite but even once I master the new enviroment I can easily foresee that it doesn't suffice to "do the right thing" in B4A.

If I correctly understood your hints, when in an Activity I have a few panels showing/hiding (each with its own layout) depending on code logic, in iOS I should use Pages residing in the same code module. Where in an B4A app I use several activities to keep logically separated sections of code, in iOS I'll use several code modules (each with one or more Pages depending on its functionality)
Classes and CustomViews should play the same role as in b4A. Services don't exist.
A final question: all the stuff the generally goes to the Starter service is it supposed to go to the Main code module?
 
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
when in an Activity I have a few panels showing/hiding (each with its own layout) depending on code logic, in iOS I should use Pages residing in the same code module
Correct

Where in an B4A app I use several activities to keep logically separated sections of code, in iOS I'll use several code modules (each with one or more Pages depending on its functionality)
Correct

Classes and CustomViews should play the same role as in b4A. Services don't exist.
Correct

A final question: all the stuff the generally goes to the Starter service is it supposed to go to the Main code module?
That's how I do it and reference it with Main.MyVariable etc and so on.

You'll get there Sir, you'll get there - there is a bit of a learning curve - but once you have it - piece of cake - I promise.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Thanks mainly to your hints I ported the great part of my B4A app in about 4 hours.
In the process I discovered a few differences (checkbox/switch, endtransaction/rollback, fonts usage, file dirs..) and learnt how to overcome them.

I know I just scratched the surface but after all it was just my first uncertain step in a new world :)

Wish I have already an iphone to start compiling and testing...

Again, thank you very much.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
when in an Activity I have a few panels showing/hiding (each with its own layout) depending on code logic, in iOS I should use Pages residing in the same code module
Not necessarily, you can also show and hide Panels in the same Page like in an Adroid Activity.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
That's true and it is how I'm doing it now, but if the Page way of doing is the standard for iOS I'll adapt my code later.
One question: in Android we're used to StartActivity()+Activity.Finish to close current activity while launching the next one(if we don't want to come back to the original activity); in iOS am I supposed to do soemthing like NavControl.RemoveCurrentPage2(True) + newcodemodule.Show (in this exact order)?

Today I've a panel on the bottom where a few ImageViews act as "commands" to switch from activity to activity. This panel is replicated on each activity's layout.
I saw that on iOS we have a ToolBar control that seems to act in a similar way. Should I go native or prefer the compatibility with B4A?
 
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
I saw that on iOS we have a ToolBar control that seems to act in a similar way. Should I go native or prefer the compatibility with B4A?

It's your choice BUT - you will meet with more favor at Apple's HQ :mad: if your app enhances "User Experience" :confused: by using their propriety tools and layouts.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Since I believe that the app will be stable for a long time once published, maybe going native will be a better choice.

Can you please teach me about the other point? Thank you.
One question: in Android we're used to StartActivity()+Activity.Finish to close current activity while launching the next one(if we don't want to come back to the original activity); in iOS am I supposed to do something like NavControl.RemoveCurrentPage2(True) + newcodemodule.Show (in this exact order)?
 
Last edited:
Upvote 0
Top