setting options while installing or after installing App - iphone

I want to set the language for one time once the user downloaded the app and started using it, for only first time. but not all the time he use the app. How can i do that?
like how we get select language options , while installing Microsoft products, etc
is this possible ?

you can control that when you application apears. Did you know about property lists?
You could use it. Or maybe you can create a file with Core data with name Configs. You need to check if field is blank and case yes, open a viewControllerChangeLanguange.After select save the data and start your application. Remember, everytime you start you will check your file. Case exists, set current language.Case not, invoke an interface to user select a language. All the controller could be made by just a file config.

Related

Flutter - how to create a framework where i can have Debug and Prod versions where debug version has some way to choose test environment

I need to create two different versions of the app.
- debug
-prod
for debug, version i need user to select the test environment before anything else begins. i need some way to know what environment user has selected and then load API endpoints config file accordingly.
what's the best way to handle this in flutter?
I have seen in some apps that for iOS, debug options are available in app settings under the standard iOS settings menu , select the app and then see those options in there.
You might want to use Flutter Flavours. As the name suggests, you can practically make flavours of the same app based on your need - debug, test, production etc. And not only API end-points, but you can also configure everything else such as app icon, different labels on the screen etc.
As suggested in this link, you can have different main.dart file for each flavour. You can read different configuration from JSON file (such as API end-point) and rest of your app will remain same. For example, see below :
This is another helpful link.

Core Data - Changing attributes type

I have a project and I am using core data.
I have some entities, with attributes. When I started the project I choose some atributes and now I want to change their types (Int to String for example). ANd so I did it.
THe thing is, I am getting errors...
I checked the code, I think every thing is ok.
I even deleted the entire entity and made a new one with some name but it doesn't work.
How can I change it with success?
You can use code data migration for this by creating new version..
To change data types you need to create a new version of the database, you can not just simply modifie it because that way your users would have to delete and redownload your app every time you change something.
Here you can read how to do this.
The simulator or device you are running the app on still 'remembers' the old type and data. Simply hold down on the app and press the 'X' to delete it. When you press play in XCode it will reinstall the app with the new data types.

Cocoa invoke Service, do not overwrite Pasteboard

I have created a Service in Cocoa which grabs the selected Text and sends the result back to my Main App, so i can handle it there ( Couldn't find any other way to get current selection), now that the Service works and appears in the Service Menu, i tried to invoke the Service from my parent App to get current selection, after some goggling around i found this snippet:
NSPasteboard *pboard = [NSPasteboard pasteboardWithUniqueName];
[pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
NSPerformService(#"PCB", pboard);
This one works as far as it triggers my Service, the Problem here is it redefines the NSPasteboard, so my service doesn't get the selected text, but a NIL Value Pasteboard which is blank, how can i prevent this?
And does someone know how to convert a .service bundle into an .app bundle that performs itself and sends the data and kills itself after finish?
thx for help
You want to get the text that is selected in another application, right? Probably in the front application, while your app is in the background.
For this to work, you'd have to have the Service be invoked by the front application. If you invoke it from your app in the background, it can't access the front app's text field that contains the selected text. Instead, it'll try to find a text field in your own app's responder chain (I believe – someone correct me if I'm wrong on this detail).
But for your code to run in the app's process, you'll have to inject it somehow, which is - out of security concerns - mostly prohibited by OS X, and especially with sandboxed apps.
There are ways to accomplish code injection, one that 1Password and other popular tools use it through an osax extension. But that's an entirely different topic.
Once you have your code running inside the other app's process, you should be able to copy the selected text (provided it's a Cocoa app) with [NSTextView writeSelectionToPasteboard:types:]. I haven't tested this myself, though, so this is just an assumption.

make the language of my IPHONE app change from the app settings without changing the language of the device

I want to make the language changeable from the application settings. For that I made a settings.bundle and i forced the langauge using this code How to force NSLocalizedString to use a specific language , I also put the UIApplicationExitsOnSuspend to YES to make my app reload every time it goes to the background.
It partially worked for me but I have 2 problems :
- The splash screen (which is localized) is not changing with this method.
- I must enter/goBack twice to make the language change effective on the application Views an this only on the OS 4 and higher.
Has anyone a solution for that?
You need to create you own translation framework for that ! Sorry !
Unfortunately there's no built-in way. What would be probably easiest would be integrate service like GetLocalization.com, so that your app would download language file via API (then it's easy to add new languages and translations even app is already released). Then what you need is just simple loader that loads that language file to memory and function that replaces the original string with translated one in run-time. You can calculate hash for original string so it's fast to search them, good algorithm for this is Peter Weinberger's hashPJW.
The trick to use specific language by selecting it from the app is to force the NSLocalizedString to use specific bundle depending on the selected language ,
here is the post i have written for this http://learning-ios.blogspot.com/2011/04/advance-localization-in-ios-apps.html
and here is the code of one sample app https://github.com/object2dot0/Advance-Localization-in-ios-apps

How can I get rid of a persistent VBA Form Object that won't honor the form deletion?

I have an MS Access 2003 database that I'm using to develop a basic little inventory app. I have added some extraneous forms along the way and I wanted to get them out of the DB. I deleted most of them just fine but one of them appears to have left behind its VBA Object. All that's in the object is Option Compare Database. Now whenever I try to work with the database, I get the following error:
The form name 'Transaction1' is misspelled or refers to a form that doesn't exist.
If the invalid form name is a macro, ...
Truncated for typings sake.
Yes, I agree, the form doesn't exist. What confuses me so much is that all of the other forms, when I deleted them, also destroyed their VBA object as well. This one, no matter what, seems to like to stick around and I have no idea how to get rid of it.
How do I get rid of it?
Things I've tried:
Compact and Repair and the DB
Create a new form named what it's expecting, verify that it gets rid of the problem, and then delete that form.
You can try the /decompile switch
Make a backup of your mdb
Open your mdb (hold the SHIFT key down to stop any code from running) via a short
cut: msaccess.exe database.mdb /decompile
Open a module and compile your app
Save and close Access
Open again (SHIFT again) without decompile
Compact and repair database
close Access
I had similar problem. I found I had named the missing form in the STARTUP menu as the default form to open when starting Access. I opened Tools>Startup and deleted the missing forms name from the "Display/Form/Page" field of the Startup. My problem solved.
The problem I was having is that the form was named ~TMPCLP8151 and would not show up in Access no matter what I tried, but I could see it in VBA in the Project Explorer. Here's how I resolved the issue. I created a new form, and created an Event Procedure for Form_Open that contained this:
DoCmd.DeleteObject acForm, "~TMPCLP8151"
Then I just opened the form, and sure enough, the VB code deleted the form that I could not delete myself.
I had a same problem. I created a form with same name and deleted the form again. That fixed the peoblem. Try. BTW try to open the new form in design mode to make sure if the VBA module is assosiated with the new form.
I had to combine both solutions to achieve the goal.
First de- and recompile
next compact and repair
then create new form with the same name and delete it
Pay attention that the form has the status Hasmodule set to Yes
I had this problem. I renamed my default form from Form Login to frmLogin which suits my naming style, but the program was still looking for it on opening. I am using 2013 so I went to File » Options » CurrentDB and in the display dropdown select the new name. The old name remains in the list until you close and restart the application.