iOS Question App not starting on iPhone 4s and 6+

Sanxion

Active Member
Licensed User
Longtime User
Hi all

I have an app that does not start on the 4S and 6+ - it is fine on the other iPhone versions. It also works on the emulator too - for all versions.

The splash screen shows and then the app stops and exists. The splash screen is called in Activity_Create.

I have added a try catch block around all the code in Activity_Create along with a message box to display the error but no message appears - the app just stops.

What else can I do to determine what the problem is?

Thanks
 

Sanxion

Active Member
Licensed User
Longtime User
Are you running it in debug mode? Are there any messages in the logs?

Have you tried to uninstall the existing app and then install it again?
No this is the release build available on the App Store.
The app has been removed and reinstalled.

I have ordered a 4S to see if I can replicate the issue.
 
Upvote 0

Sanxion

Active Member
Licensed User
Longtime User
If you like send me the project and I'll test it here on 4S.

I received the iPhone 4S and I have been attempting to determine what the error is.

The 'error' occurs in a Sub that positions a series of panels, labels and scrollviews - but at different points. It seems to be random. There is no error which is thrown and nothing appears in the logs.

This is the code:

B4X:
txt = File.ReadString(File.DirAssets, "Lesson8Notes.txt")    ' load the text file into the string
    pnlLesson8Notes.Top = 10%y
    pnlLesson8Notes.Left = 10%x
    pnlLesson8Notes.Width = 80%x
    pnlLesson8Notes.Height = 80%y
    lblLesson8NotesHeader.Width = 80%x
    lblLesson8NotesHeader.Height = 20%y
    lblLesson8Notes.Initialize(" ")
    lblLesson8Notes.Font = Font.CreateNew2("schalk",20)
    lblLesson8Notes.TextColor = Colors.White
    lblLesson8Notes.Multiline = True
    lblLesson8Notes.Width=scvLesson8Notes.Width
    lblLesson8Notes.SizeToFit
    scvLesson8Notes.Panel.AddView(lblLesson8Notes,0,0,80%x,60%y)
    lblLesson8Notes.Text = txt
    scvLesson8Notes.ContentHeight = lblLesson8Notes.Height                        
    scvLesson8Notes.ScrollOffsetY = 0
 
Last edited:
Upvote 0

Sanxion

Active Member
Licensed User
Longtime User
I tested your app. It is running out of memory.

You need to add Log messages to see where it happens.

The two large background images will require 10mb of memory each. Start with reducing there size.
Thank-you. Two questions:
How do I get the amount of memory used in order to add it to the log?
The two images - I assume you are referring to the splash screen and the main background image?
Can I not unload the spash screen once the main image appears in order to free some space?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code to find the used memory size:
B4X:
Sub UsedMemory As Long
   Dim no As NativeObject = Me
   Return no.RunMethod("usedMemory", Null).AsNumber
End Sub

#if OBJC
#import "mach/mach.h"
- (vm_size_t) usedMemory {
  struct task_basic_info info;
  mach_msg_type_number_t size = sizeof(info);
  kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);
  return (kerr == KERN_SUCCESS) ? info.resident_size : 0; // size in bytes
}

#end if

The two images - I assume you are referring to the splash screen and the main background image?
Yes.

Can I not unload the spash screen once the main image appears in order to free some space?
Yes. But it is not freed immediately. The first step is to eliminate the crash.
 
Upvote 0
Top