Attempt to add read-only file at path file:///var/mobile/Media/PhotoData/Photos.sqlite? - uiimagepickercontroller

I have just updated to the new Xcode beta 6.0 and when trying to compile for an ipad mini with iOS 8 I am getting a weird error in the console:
"Attempt to add read-only file at path file:///var/mobile/Media/PhotoData/Photos.sqlite?readonly_shm=1 read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption"
This happens when executing the following code:
if ([self.rootDelegate respondsToSelector:#selector(wImageRequiresAPhotoPicker:)]){
[self.rootDelegate wImageRequiresAPhotoPicker:(DWImage*)item];
}
And:
-(void)wImageRequiresAPhotoPicker:(DWImage *)img{
self.selectedWimg = img;
DWImagePickerController *imgPicker = [[DWImagePickerController alloc] init];
[imgPicker setDelegate:self];
[imgPicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imgPicker setAllowsEditing:YES];
[imgPicker setModalPresentationStyle:UIModalPresentationCurrentContext];
UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:imgPicker];
popOver.delegate = self;
self.popoverImageViewController = popOver;
[self.popoverImageViewController presentPopoverFromRect:img.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
Does anyone have a clue of why this is happening?

Most likely a newly introduced bug in iOS 8 beta 2. Let's see how it develops.
It seems that ALAssetsLibrary requests internally read & write access to Photos.sqlite database, and it can only gain read access. I'm receiving the same error with this call:
[self.assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
...

It is a core data error, and since my app does not use core data, and I receive the error when I access the photo library picker, I'm gonna say it is on Apple, and a bug. Apparently files are attempting to be added as read/write and they are read only. I'm pretty sure Apple should know this, since they set up the image picker. I'm just trying to access it.
self.pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

Related

background gps updates not received on WatchOS 4

Posting this question with an answer so other's can find it.
We have an app on the store which records an activity's path. When we updated the WatchOS to version 4, our background gps updates stopped when the app transitioned into the background.
Some research found this link on Apple's Developer site that shows we need to set a new property in the location manager.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
if (#available(watchOS 4.0, *)) {
self.locationManager.activityType = CLActivityTypeOther;
self.locationManager.allowsBackgroundLocationUpdates = YES; // NEW!!
}
[self.locationManager startUpdatingLocation];
See the line marked "NEW!!" That's what allowed the app to receive background location updates again. You also need to have the properties set as mentioned in the link.
Apps that want to receive location updates when suspended must include
the UIBackgroundModes key (with the location value) in their app’s
Info.plist file and set the value of this property to YES. The
presence of the UIBackgroundModes key with the location value is
required for background updates

Is it possible to transfer sqlite file to watch os 2

Can any one help me out on this problem. I am struggling to transfer the sqlite to watch os 2. If you have any example share with me or please give your suggestion on this
Have not tried this for sqlLite files but works with audioFiles.
What I did is:
Turn ON App Group both on watch extension and main project.
Place file in App Group Container
// I create the file there so my code is
NSURL * urlOut = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier: APP_CONECTIVITY_ID];
urlOut = [urlOut URLByAppendingPathComponent:#"myfile.wav"];
Send via WCSession sendMessage the link, need to send as string so you will send urlOut.absoluteString.
Profit?
You should be able to use stuff like sendMessageData //reading the file as date beforhand.
and there is also this WCSessionFileTransfer.
But I haven't had a chance to try that yet.

How to enable LocalStorage in Qt 5.3

I tried the method:
QWebSettings* settings = QWebSettings::globalSettings();
settings->setAttribute(QWebSettings::LocalStorageEnabled, true);
auto path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
settings->setOfflineStoragePath(path);
window.localStorage is true(not null or undefined), but when I insert a item into the localStorage:
localStorage.setItem("b","isaac");
alert(localStorage["b"]);
The error is happened, and the error messages in the webkit inspector console are:
QuotaExceededError: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.
I was raging all day, because it was not working after restart of the app.
So I think this will be helpfull for someone:
QWebSettings* settings = QWebSettings::globalSettings();
settings->setAttribute(QWebSettings::LocalStorageEnabled, true);
auto path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
settings->setOfflineStoragePath(path);
settings->enablePersistentStorage(path);
Notice the enablePersistentStorage
I forgot I've enable a very important swithcer:
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled,true);
This will set the browser to private mode and prevent you to insert value to localStorage. But the official api doc doesn't mention it.
You just set disable the switcher can solve the problem:
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled,false);

JClouds not able to get the list of images

I have used the code below:
Iterable<Module> modules = ImmutableSet.<Module> of(
new SshjSshClientModule());
ContextBuilder builder = ContextBuilder.newBuilder(provider).endpoint(endpoint)
.credentials(identity, credential)
.modules(modules);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
ComputeService compute = builder.buildView(ComputeServiceContext.class).getComputeService();
System.out.println(compute1.listImages());
but I am getting the following error message.........
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 787
at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:181)
at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.readAndBuild(NullFilteringTypeAdapterFactories.java:92)
The code was working... before...
You've definitely hit a bug somewhere between the version of jclouds you're using and whatever version of whatever cloud you're using. We'll need more information to fix this. Please go through the instruction on how to Report a Bug to Apache jclouds.

Simulator quits unexpectedly giving error, Springboard failed to launch error: -3

I am trying to make a basic Application with a background Gradient, Navigation Bar and a logo on it. When Launched in a simulator an error pops up, saying Springboard failed to launch error: -3
I am Using the Following two in code in the ViewController:-
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.title = #"Menu";
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(257, 3, 320, 44)];
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:#"ic_home.png"]];
[image setFrame:CGRectMake(0, 0, 59, 36)];
[view addSubview:image];
[self.navigationController.navigationBar addSubview:view];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//Add gradient background
CAGradientLayer *bgLayer = [BackgroundLayer yellowGradient];
bgLayer.frame = self.view.bounds;
[self.view.layer insertSublayer:bgLayer atIndex:0];
}
not sure if this is the most technical answer but still...
Injectios is right, it's not your code (or at least my code never causes that) it's something to do with interface builder/putting files onto the simulator (from my experience).
Simply change the device that your building for and then switch back (for example, if developing for the 3.5" iPhone screen, click the 4" simulator and run, once it builds stop it and switch back to your target device) If you are using xcode 5 the list of devices is on the same toolbar as your Run and Stop buttons or go Product -> Destination
hope it helps
How about trying to delete the app from the simulator and restarting the simulator?
In my case, none of the above answers worked. So in my desperation I finally decided to revise all warnings and resolving them. It turned out that the root of the problem was that I was sending objects of wrong type to NSNumberFormatter and other classes/objects.
So in short: revise all your warnings and resolve all of them that mention pointer conversion problems.
Try reset the simulator
simulator -> reset contents and settings
It is worked for me

Resources