iOS Question I want to change icon App from app..get error..

naifnas

Active Member
Licensed User
hi all
i want to change App from App ?
i try use this setAlternateIconName
but need add this

B4X:
#PlistExtra: <key>CFBundleIcons</key>
#PlistExtra: <dict>
#PlistExtra: <key>CFBundleAlternateIcons</key>
#PlistExtra: <dict>
#PlistExtra: <key>nmIcon1</key>
#PlistExtra:  <dict>
#PlistExtra:  <key>CFBundleIconFiles</key>
#PlistExtra:  <Array>
#PlistExtra:  <string>alternater1</string>
#PlistExtra:   </Array>
#PlistExtra:    <key>UIPrerenderedIcon</key>
#PlistExtra:    <False/>
#PlistExtra:  </dict>
#PlistExtra:  <key>nmIcon2</key>
#PlistExtra:  <dict>
#PlistExtra:   <key>CFBundleIconFiles</key>
#PlistExtra:   <Array>
#PlistExtra:   <string>alternater2</string>
#PlistExtra:    </Array>
#PlistExtra:   </dict>
#PlistExtra:  </dict>
#PlistExtra: </dict>

I have error
B4X:
note: Using new build system
note: Planning build
note: Constructing build description
error: Bundle identifier is missing. B4iProject doesn't have a bundle identifier. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor. (in target 'B4iProject' from project 'B4iProject')


Error: ** BUILD FAILED **
 

naifnas

Active Member
Licensed User
I don't understand what are you trying to do...
😭
I want to change the application icon to an additional icon
As per Apple policy
The apparent link in the following link

As for your question, what is the purpose?
I want to change the icon some times when there are app additions, new messages, or ..
 
Upvote 0

naifnas

Active Member
Licensed User
1. There are many "case" mistakes in the plist. Everything should be lowercased.
2. Put the additional icon in Files\Special folder.
I already put additional icon in Files\Special folder ( size 120x120
and 180x180)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
1) According my experiments alternate icons should be in Files (like any other images).

2) Compile in release mode. In Debug mode API function returns success, but app icon is not updated on the screen.
This is true at least for simulators, I did not test on iPhones.

3) To prevent alert, take a look lc_setAlternateIconName subroutine in https://stackoverflow.com/questions/48485920/alternate-icon-disable-alert-on-icon-change-update
From one side, private API is not a good idea, even Apple does not reject. But from another side, this sub works up to now.
 
Upvote 0

naifnas

Active Member
Licensed User
1) According my experiments alternate icons should be in Files (like any other images).

2) Compile in release mode. In Debug mode API function returns success, but app icon is not updated on the screen.
This is true at least for simulators, I did not test on iPhones.

3) To prevent alert, take a look lc_setAlternateIconName subroutine in https://stackoverflow.com/questions/48485920/alternate-icon-disable-alert-on-icon-change-update
From one side, private API is not a good idea, even Apple does not reject. But from another side, this sub works up to now.
thanks for your answer
need write to #plist
and in plist has UIPrerenderedIcon set to NO
most Change it to YES
 
Upvote 0

naifnas

Active Member
Licensed User
Try this sample in Release mode.
thanks ..
i already do it
I added to plist
B4X:
#PlistExtra:<key>CFBundleIcons</key>
#PlistExtra:    <dict>
#PlistExtra:    <key>CFBundleAlternateIcons</key>
#PlistExtra:    <dict>
#PlistExtra:        <key>Icon11</key>
#PlistExtra:    <dict>
'#PlistExtra:            <key>CFBundleIconFiles</key> <Array><string></string></Array>
#PlistExtra:            <key>UIPrerenderedIcon</key><true/>
#PlistExtra:        </dict>
#PlistExtra:    </dict>
#PlistExtra:</dict>

B4X:
     [[UIApplication sharedApplication] setAlternateIconName:iconName completionHandler:^(NSError * _Nullable error) {
        NSLog(@"Error...");
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Strange. I did this one minute ago. Refresh a webpage and try to download again.
setAlternateIconName, as it is, alerts. So I used a subroutine from stackoverflow.
 
Upvote 0
Top