iOS Question save to gallery

soroush_safarii

Member
Licensed User
hello
i wrote code to receive url then show and save to gallery
but when i start and paste url to text field , app show image but don't save to gallery and crash
what is worng ?
@Erel
 

Attachments

  • dw.zip
    39.5 KB · Views: 148

soroush_safarii

Member
Licensed User
Please don't limit your questions to a single member. I will not answer such questions.

You should also post the relevant source code in the post itself and add the error message from the logs.

i'm sorry for this
but in log section , b4i don't show any error
in other to , i don't receive any error in log menu , only app crash and don't save image in gallery
 
Upvote 0

soroush_safarii

Member
Licensed User
I ran your project and it is not clear how to reproduce it. You should make it easier for us to help you. Configure the project in such way that we only need to run it to get to the problematic point.

I will not guess which url to enter in the field.
i clear my code and fix it ,
now see when click on save button , application crash and dont show any error and don't save to gallery
and url like this : https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png
i so sorry , i am beginner ,
 

Attachments

  • dw1.zip
    78.8 KB · Views: 151
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Always make a new Httpjob for each request.
2. You should set the job name by calling Job.Initialize.

This code works:
B4X:
Sub btn_Click
   Dim h1 As HttpJob 'no need to make it a global variable
   h1.Initialize("dnimg", Me)
   h1.Download("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png")
End Sub
 
Upvote 0

soroush_safarii

Member
Licensed User
1. Always make a new Httpjob for each request.
2. You should set the job name by calling Job.Initialize.

This code works:
B4X:
Sub btn_Click
   Dim h1 As HttpJob 'no need to make it a global variable
   h1.Initialize("dnimg", Me)
   h1.Download("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png")
End Sub
i have problem with save to gallery ,
this code you post ,for download.

for save image to gallery , what i do ?
i write code but app crash and dont show any error
@Erel
 
Last edited:
Upvote 0

soroush_safarii

Member
Licensed User
There is a new requirement in iOS 10. You need to add this line:
B4X:
#PlistExtra: <key>NSPhotoLibraryUsageDescription</key><string>This app needs access to photos.</string>
thank you erel , you are the best
i sorry sometime i do wrong , such as i start conversation to you or limit my question to you and etc ,
best regard for you
its solved
 
Upvote 0
Top